import { shapePreservingProjectIsLoaded, isLoaded, shapePreservingProjectLoad, load, shapePreservingProjectExecute } from "@arcgis/core/geometry/operators/shapePreservingProjectOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.32

Transforms 2D geometry segment end points and interior points, thus preserving the geographic location of the segment interior and more accurately maintaining its original shape. A maximum offset deviation parameter controls how much the result of the projection is allowed to deviate from the true preserved shape.

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 the getTransformation() and getTransformations() 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.
  • 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.
  • Curves are not supported.

Notes

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

See also

Type definitions

ShapePreservingProjectOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

areaOfInterestExtent

Property
Type
Extent | undefined

An 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 geometries spatial reference.

geographicTransformation

Property
Type
GeographicTransformation | undefined

The equation-based geographic transformation used to transform the geometries. Grid-based transformations are not supported.

maxDeviationInSrTo

Property
Type
number | undefined

Controls how much the result of the projection is allowed to deviate from the true preserved shape. The default setting of 0 represents 100 * output tolerance.

Default value
0

minSegmentLengthInDegrees

Property
Type
number | undefined

A lower bound controlling the densification in the input coordinate system. The default setting of 0 represents 1e-5 degrees. If the input coordinate system is a projected coordinate system, then this value is translated to length in linear units at the equator.

Default value
0

Options

deprecated Type definition

Functions

shapePreservingProjectIsLoaded

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if all dependencies of this module have been loaded.

Signature
shapePreservingProjectIsLoaded (): 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.

shapePreservingProjectLoad

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

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

See also
Signature
shapePreservingProjectLoad (): 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.

shapePreservingProjectExecute

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Performs the shape preserving project operation on a single geometry.

Signature
shapePreservingProjectExecute (geometry: GeometryUnion, outSpatialReference: SpatialReference, options?: ShapePreservingProjectOptions): GeometryWithoutMeshUnion | null | undefined

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to be projected.

outSpatialReference

The spatial reference to which the input geometry is projected.

options

Additional options.

Returns
GeometryWithoutMeshUnion | null | undefined

The projected geometry or null.

Example
if (!shapePreservingProjectIsLoaded()) {
await shapePreservingProjectLoad();
}
// Project a geometry to a different spatial reference while preserving its shape.
const geometry = shapePreservingProjectExecute(polyline, spatialReference);

execute

deprecated Function

Performs the shape preserving project operation on a single geometry.

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

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to be projected.

outSpatialReference

The spatial reference to which the input geometry is projected.

options

Additional options.

Returns
GeometryWithoutMeshUnion | null | undefined

The projected geometry or null.

Example
if (!shapePreservingProjectIsLoaded()) {
await shapePreservingProjectLoad();
}
// Project a geometry to a different spatial reference while preserving its shape.
const geometry = shapePreservingProjectExecute(polyline, spatialReference);

shapePreservingProjectExecuteMany

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Performs the shape preserving project operation on multiple geometries.

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

Parameters

ParameterTypeDescriptionRequired
geometries

The geometries to be projected. All the geometries must have the same spatial reference.

outSpatialReference

The spatial reference to which the input geometries are 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

Performs the shape preserving project operation on multiple geometries.

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

Parameters

ParameterTypeDescriptionRequired
geometries

The geometries to be projected. All the geometries must have the same spatial reference.

outSpatialReference

The spatial reference to which the input geometries are projected.

options

Additional options.

Returns
(GeometryWithoutMeshUnion | null | undefined)[]

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

Variables

shapePreservingProjectSupportsCurves

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 false.

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 false.

Type
boolean | null | undefined