▾
import { projectIsLoaded, isLoaded, projectLoad, load, projectExecute } from "@arcgis/core/geometry/operators/projectOperator.js";const { projectIsLoaded, isLoaded, projectLoad, load, projectExecute } = await $arcgis.import("@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.
Functions
projectIsLoaded
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Indicates if all dependencies of this module have been loaded.
- Signature
-
projectIsLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
isLoaded
Indicates if all dependencies of this module have been loaded.
- Signature
-
isLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
projectLoad
- 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>
load
Loads this module's dependencies. This method must be called first if isLoaded returns false.
- See also
- Signature
-
load (): Promise<void>
projectExecute
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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 referenceconst geometry = projectExecute(polygon, outSpatialReference);
execute
Projects a geometry to the specified output spatial reference.
- Signature
-
execute (geometry: GeometryUnion, outSpatialReference: SpatialReference, options?: ProjectOptions): GeometryWithoutMeshUnion | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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 referenceconst geometry = projectExecute(polygon, outSpatialReference);
projectExecuteMany
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
nullorundefined.
executeMany
Projects an array of geometries to the specified output spatial reference.
- Signature
-
executeMany (geometries: GeometryUnion[], outSpatialReference: SpatialReference, options?: ProjectOptions): (GeometryWithoutMeshUnion | null | undefined)[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
nullorundefined.