require(["esri/geometry/operators/projectOperator"], (projectOperator) => { /* code goes here */ });
import * as projectOperator from "@arcgis/core/geometry/operators/projectOperator.js";
esri/geometry/operators/projectOperator
Projects 2D geometries 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.
Known Limitations
- This operator currently only supports equation-based geographic transformations.
- The result geometry is not guaranteed to be simple. Apply the simplifyOperator to ensure result is topologically simple.
Notes
- Verify that
isLoaded()
returnstrue
before using this module. - Use
load()
to load this module's dependencies.
Property Overview
Name | Type | Summary | Object |
---|---|---|---|
Indicates if the operator supports input geometries that contain curves. | projectOperator |
Property Details
-
Indicates if the operator supports input geometries that contain curves. This will produce densified output geometries.
- Default Value:true
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Projects a geometry to the specified output spatial reference. | projectOperator | ||
Projects an array of geometries to the specified output spatial reference. | projectOperator | ||
Indicates if all dependencies of this module have been loaded. | projectOperator | ||
Promise | Loads this module's dependencies. | projectOperator |
Method Details
-
execute
execute(geometry, outSpatialReference, options){GeometryUnion}
-
Projects a geometry to the specified output spatial reference.
ParametersSpecificationgeometry GeometryUnionThe geometry to project.
outSpatialReference SpatialReferenceThe spatial reference to which the input geometry is projected.
options ObjectoptionalAdditional options.
SpecificationareaOfInterestExtent ExtentoptionalAn extent used to help pick the correct transform. This is not used if the
geographicTransformation
option is provided. The extent's spatial reference should be the same as the spatial reference of the input geometry.geographicTransformation GeographicTransformationoptionalThe geographic transformation used to transform the geometries. Specify this parameter to project a geometry when the default transformation is not appropriate for your requirements.
ReturnsType Description GeometryUnion Returns the projected geometry. Exampleif (!projectOperator.isLoaded()) { await projectOperator.load(); } const outSpatialReference = new SpatialReference({ wkid: 53008 //Sphere_Sinusoidal projection }); // Project a geometry to a different spatial reference const geometry = projectOperator.execute(polygon, outSpatialReference);
-
executeMany
executeMany(geometries, outSpatialReference, options){GeometryUnion[]}
-
Projects an array of geometries to the specified output spatial reference.
ParametersSpecificationgeometries GeometryUnion[]An array of geometries to project. All the geometries must have the same spatial reference.
outSpatialReference SpatialReferenceThe spatial reference to which the input geometry is projected.
options ObjectoptionalAdditional options.
SpecificationareaOfInterestExtent ExtentoptionalAn extent used to help pick the correct transform. This is not used if the
geographicTransformation
option is provided. The extent's spatial reference should be the same as thegeometries
spatial reference.geographicTransformation GeographicTransformationoptionalThe geographic transformation used to transform the geometries. Specify this parameter to project a geometry when the default transformation is not appropriate for your requirements.
ReturnsType Description GeometryUnion[] Returns the projected geometries.
-
Loads this module's dependencies. This method must be called first if
isLoaded
returnsfalse
.ReturnsType Description Promise Resolves when the dependencies have been loaded. - See also