Skip to content
Last updated

API / geotoolkit / map / coordinatesystems / UTM / UTM

Class: UTM

coordinatesystems.UTM.UTM

Based on Geographic/UTM (Universal Transverse Mercator) Coordinate Converter

Example

// To calculate a line n(x,y) meter away from particular latitude and longitude…..where x is distance towards east west, y is distance towards north south
import {UTM} from '@int/geotoolkit/map/coordinatesystems/UTM';
import {Polygon} from '@int/geotoolkit/scene/shapes/Polygon';
const system = new UTM(15, false); // 15 UTM zone, north hemisphere ('true' for southern)
const origin = system.transform(-95.388718, 29.716131); // your lat/lon origin, Houston coordinates here
const coordsX = [100, -200, 300]; // your coordinates in meters from the 'origin' lat/long point
const newX = coordsX.map((x) => x + origin.getX());  // shifting relative to the initial point
... // same for the Y coordinates
const polygon = new Polygon({ // Your polygon to draw
'x': newX,
'y': newY
});

Example

// To find the distance between the two lat/long points only by transforming them to UTM:
import {UTM} from '@int/geotoolkit/map/coordinatesystems/UTM';
import {Point} from '@int/geotoolkit/util/Point';
const system = new UTM(18, false);
const point1 = system.transform(-77.009003, 38.889931); // Washington
const point2 = system.transform(-75.165222, 39.952583); // Philadelphia
Point.getDistance(point1, point2); // 197744 meters
// You can also use the 'system' property in map layers for automatic conversion from one coordinate system to another

Example

// To calculate the UTM zone dynamically:
const lat = 29.761993, lon = -95.366302; // your latitude/longitude for the origin point
const zone = Math.floor((lon + 180) / 6) % 60 + 1; // formula for UTM zone
const southern = (lat < 0); // calculate hemishere
const system = new UTM(zone, southern); // create system for the point
const point1 = system.transform(lon, lat); // transform point to UTM
const point2 = new Point(point1.x + dx, point1.y + dy); // dx, dy - distance between point1 & point2 in meters
system.inverseTransform(point2.x, point2.y, point2); // transform 'point2' back to lat/long coordinate system

Hierarchy

Table of contents

Constructors
[new UTM(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.map.coordinatesystems.utm.utm.md#new utm(options))[new UTM(zone, southhemi)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.map.coordinatesystems.utm.utm.md#new utm(zone, southhemi))
Methods

Contents

Constructors

new UTM(options)

• new UTM(options?)

Parameters

Name Type Description
Optional optionsOptionsoptions to specify UTM coordinate system

Overrides

AbstractSystem.constructor


new UTM(zone, southhemi)

• new UTM(zone?, southhemi?)

Parameters

Name Type Description
Optional zonenumberUTM time zone
Optional southhemibooleantrue for southern hemisphere, false otherwise

Overrides

AbstractSystem.constructor

Methods

getClassName

▸ getClassName(): string

Returns

string

Inherited from

AbstractSystem.getClassName


getDefaultModelLimits

▸ getDefaultModelLimits(): Rect

Gets the default minimal rectangular bounding region that will entirely contain this AbstractSystem (approximately). A CSR is an arbitrary complex closed region that touches the rectangular extent at least once on all four sides.

Returns

Rect

Inherited from

AbstractSystem.getDefaultModelLimits


getEpsgCode

▸ getEpsgCode(): number

Return epsg code of the coordinate system

Returns

number

epsg code

Inherited from

AbstractSystem.getEpsgCode


getName

▸ getName(): string

Return a name of the coordinate system

Returns

string

Inherited from

AbstractSystem.getName


getUnits

▸ getUnits(): AbstractUnit

Return units of the coordinate system

Returns

AbstractUnit

Inherited from

AbstractSystem.getUnits


getZone

▸ getZone(): number

Returns

number

the current zone


inverseTransform

▸ inverseTransform(x, y, dst?): Point

Return transformed point to lat / lng from projection

Parameters

Name Type Description
xnumberx coordinate
ynumbery coordinate
Optional dstPointoptional destination point

Returns

Point

Overrides

AbstractSystem.inverseTransform


isSouthernHemisphere

▸ isSouthernHemisphere(): boolean

Return true if it is southern hemisphere

Returns

boolean


isVerticalAxisUp

▸ isVerticalAxisUp(): boolean

Return if vertical axis goes up

Returns

boolean

Inherited from

AbstractSystem.isVerticalAxisUp


setSouthernHemisphere

▸ setSouthernHemisphere(southhemi): UTM

Set southern or northern hemisphere

Parameters

Name Type Description
southhemibooleantrue if southern

Returns

UTM

this


setZone

▸ setZone(zone): UTM

Sets the current zone

Parameters

Name Type Description
zonenumbercurrent zone

Returns

UTM

this


transform

▸ transform(lon, lat, dst?): Point

Transforms the specified coordinate to projection from lat / lon

Parameters

Name Type Description
lonnumberlong
latnumberlat
Optional dstPointoptional destination point

Returns

Point

Overrides

AbstractSystem.transform


getClassName

▸ Static getClassName(): string

Returns

string

Inherited from

AbstractSystem.getClassName