import { projectIsLoaded, isLoaded, projectLoad, load, projectExecute } from "@arcgis/core/geometry/operators/projectOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.32

Projects geometries (with or without Z/elevation data) from one SpatialReference to another. You can specify a geographic (datum) transformation for this operation, accept the default transformation if one is needed, or set the area of interest.

Projecting your data between coordinate systems sometimes requires transforming between geographic coordinate systems. Geographic transformations are used to transform coordinates between spatial references that have different geographic coordinate systems, and thus different datums. Using the most suitable transformation ensures the best possible accuracy when converting geometries from one spatial reference to another.

The geographicTransformationUtils module provides methods which return the default geographic transformation for the given projection or a list of suitable geographic transformations.

The operator supports limited Z value conversion when the units of the spatial references are different (for example when projecting from NAD83 to WGS84). Full vertical coordinate projection is not available and the operator will throw an exception if the input and output have different vertical coordinate systems.

Known Limitations

  • This operator currently only supports equation-based geographic transformations.
  • Grid-based transformations are not supported.
  • Vertical coordinate system projections are not supported.
  • The result geometry is not guaranteed to be simple. Apply the simplifyOperator to ensure the result is topologically simple.
  • Projecting an Extent may return an Extent with a larger area than the input.

Notes

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

See also

Functions

projectIsLoaded

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if all dependencies of this module have been loaded.

Signature
projectIsLoaded (): boolean
Returns
boolean

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

isLoaded

deprecated Function

Indicates if all dependencies of this module have been loaded.

Signature
isLoaded (): boolean
Returns
boolean

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

projectLoad

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

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

See also
Signature
projectLoad (): Promise<void>
Returns
Promise<void>

Resolves when the dependencies have been loaded.

load

deprecated Function

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

See also
Signature
load (): Promise<void>
Returns
Promise<void>

Resolves when the dependencies have been loaded.

projectExecute

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Projects a geometry to the specified output spatial reference.

Signature
projectExecute (geometry: GeometryUnion, outSpatialReference: SpatialReference, options?: ProjectOptions): GeometryWithoutMeshUnion | null | undefined

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to project.

outSpatialReference

The spatial reference to which the input geometry is projected.

options

Additional options.

Returns
GeometryWithoutMeshUnion | null | undefined

Returns the projected geometry or null.

Example
if (!projectIsLoaded()) {
await projectLoad();
}
const outSpatialReference = new SpatialReference({
wkid: 53008 //Sphere_Sinusoidal projection
});
// Project a geometry to a different spatial reference
const geometry = projectExecute(polygon, outSpatialReference);

execute

deprecated Function

Projects a geometry to the specified output spatial reference.

Signature
execute (geometry: GeometryUnion, outSpatialReference: SpatialReference, options?: ProjectOptions): GeometryWithoutMeshUnion | null | undefined

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to project.

outSpatialReference

The spatial reference to which the input geometry is projected.

options

Additional options.

Returns
GeometryWithoutMeshUnion | null | undefined

Returns the projected geometry or null.

Example
if (!projectIsLoaded()) {
await projectLoad();
}
const outSpatialReference = new SpatialReference({
wkid: 53008 //Sphere_Sinusoidal projection
});
// Project a geometry to a different spatial reference
const geometry = projectExecute(polygon, outSpatialReference);

projectExecuteMany

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Projects an array of geometries to the specified output spatial reference.

Signature
projectExecuteMany (geometries: GeometryUnion[], outSpatialReference: SpatialReference, options?: ProjectOptions): (GeometryWithoutMeshUnion | null | undefined)[]

Parameters

ParameterTypeDescriptionRequired
geometries

An array of geometries to project. All the geometries must have the same spatial reference.

outSpatialReference

The spatial reference to which the input geometry is projected.

options

Additional options.

Returns
(GeometryWithoutMeshUnion | null | undefined)[]

Returns an array of projected geometries, and individual entries may be null or undefined.

executeMany

deprecated Function

Projects an array of geometries to the specified output spatial reference.

Signature
executeMany (geometries: GeometryUnion[], outSpatialReference: SpatialReference, options?: ProjectOptions): (GeometryWithoutMeshUnion | null | undefined)[]

Parameters

ParameterTypeDescriptionRequired
geometries

An array of geometries to project. All the geometries must have the same spatial reference.

outSpatialReference

The spatial reference to which the input geometry is projected.

options

Additional options.

Returns
(GeometryWithoutMeshUnion | null | undefined)[]

Returns an array of projected geometries, and individual entries may be null or undefined.

Variables

projectSupportsCurves

Variable
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if the operator supports input geometries that contain curves. The value is null or undefined until the operator is loaded, then it will always be true. This will produce densified output geometries.

Type
boolean | null | undefined

supportsCurves

deprecated Variable

Indicates if the operator supports input geometries that contain curves. The value is null or undefined until the operator is loaded, then it will always be true. This will produce densified output geometries.

Type
boolean | null | undefined