geographicTransformationUtils

AMD: require(["esri/geometry/operators/support/geographicTransformationUtils"], (geographicTransformationUtils) => { /* code goes here */ });
ESM: import * as geographicTransformationUtils from "@arcgis/core/geometry/operators/support/geographicTransformationUtils.js";
Object: esri/geometry/operators/support/geographicTransformationUtils
Since: ArcGIS Maps SDK for JavaScript 4.32

A set of utilities for working with geographic transformations.

Notes

  • Verify that isLoaded() returns true before using this module.
  • Use load() to load this module's dependencies.

Method Overview

Name Return Type Summary Object

Returns the default equation-based, geographic transformation used to convert a geometry from the input spatial reference to the output spatial reference.

geographicTransformationUtils

Returns a list of all equation-based, geographic transformations suitable to convert geometries from the input spatial reference to the specified output spatial reference.

geographicTransformationUtils

Indicates if all dependencies of this module have been loaded.

geographicTransformationUtils
Promise

Loads this module's dependencies.

geographicTransformationUtils

Method Details

getTransformation

Method
getTransformation(inSpatialReference, outSpatialReference, areaOfInterestExtent){GeographicTransformation |null |undefined}

Returns the default equation-based, geographic transformation used to convert a geometry from the input spatial reference to the output spatial reference. The default transformation is used when projecting geometries using the projectOperator where the datum transformation is required but not specified in the operator's geographicTransformation parameter.

Known Limitations

  • This method returns only equation-based geographic transformations.
  • Geographic transformations are returned with their maximum number of steps. Currently, the number of steps is limited to 2.
Parameters
inSpatialReference SpatialReference

The input spatial reference from which to project geometries. This is the spatial reference of the input geometries.

outSpatialReference SpatialReference

The spatial reference to which you are converting the geometries.

areaOfInterestExtent Extent|null|undefined
optional

An extent used to determine the suitability of the returned transformation. The extent's spatial reference should be the same as inSpatialReference.

Returns
Type Description
GeographicTransformation | null | undefined Returns the default geographic transformation for the given parameters. If no transformation is required or there are no suitable transformations, then null is returned.
Example
const cs1 = new SpatialReference({
  wkid: 4272 //PE_GCS_ED_1950
});

const cs2 = new SpatialReference({
  wkid: 4167
});

const extent = new Extent({
  xmin: -186.0,
  ymin: -42.0,
  xmax: -179.0,
  ymax: -38.0,
  spatialReference: cs1
});

if (!geographicTransformationUtils.isLoaded()) {
  await geographicTransformationUtils.load();
}

const geogtrans = projection.getTransformation(cs1, cs2, extent);

getTransformations

Method
getTransformations(inSpatialReference, outSpatialReference, areaOfInterestExtent){GeographicTransformation[]}

Returns a list of all equation-based, geographic transformations suitable to convert geometries from the input spatial reference to the specified output spatial reference. The list is ordered in descending order by suitability, with the most suitable being first in the list.

Known Limitations

  • This method returns only equation-based geographic transformations.
  • Geographic transformations are returned with their maximum number of steps. Currently, number of steps is limited to 2.
Parameters
inSpatialReference SpatialReference

The spatial reference that the geometries are currently using.

outSpatialReference SpatialReference

The spatial reference to which you are converting the geometries to.

areaOfInterestExtent Extent|null|undefined
optional

An extent used to help pick the correct transform. The extent's spatial reference should be the same as inSpatialReference.

Returns
Type Description
GeographicTransformation[] Returns an array containing the maximum number the suitable geographic transformations that can be used to convert geometries between input and output spatial references. The list will be empty if the provided extent lies out of the area of use for the input spatial reference, or if no transformation is required, or there are no suitable transformations.
Example
const cs1 = new SpatialReference({
  wkid: 4272 //PE_GCS_ED_1950
});

const cs2 = new SpatialReference({
  wkid: 4167
});

const extent = new Extent({
  xmin: -186.0,
  ymin: -42.0,
  xmax: -179.0,
  ymax: -38.0,
  spatialReference: cs1
});

if (!geographicTransformationUtils.isLoaded()) {
  await geographicTransformationUtils.load();
}

const geogtrans = projection.getTransformations(cs1, cs2, extent);
geogtrans.forEach((geogtran, index) => {
  geogtran.steps.forEach((step, index) => {
    console.log("step wkid: ", step.wkid);
  });
});

isLoaded

Method
isLoaded(){Boolean}

Indicates if all dependencies of this module have been loaded.

Returns
Type Description
Boolean Returns true if this module's dependencies have been loaded.

load

Method
load(){Promise}

Loads this module's dependencies. This method must be called first if isLoaded returns false.

Returns
Type Description
Promise Resolves when the dependencies have been loaded.
See also

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.