require(["esri/geometry/support/normalizeUtils"], (normalizeUtils) => { /* code goes here */ });
import * as normalizeUtils from "@arcgis/core/geometry/support/normalizeUtils.js";
esri/geometry/support/normalizeUtils
Provides a utility method that normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the coordinate system of the view. Support is limited to geometries in Web Mercator and WGS-84 spatial references.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Returns an extent over the dateline that is smaller than the normalized width if it visually contains the geometry. | normalizeUtils | ||
Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the coordinate system of the view. | normalizeUtils |
Method Details
-
Since: ArcGIS Maps SDK for JavaScript 4.21normalizeUtils since 4.3, getDenormalizedExtent added at 4.21. -
Returns an extent over the dateline that is smaller than the normalized width if it visually contains the geometry. The input geometry must be normalized and its spatialReference must be Web Mercator or WGS84.
Parametergeometry GeometryUnion|null|undefinedThe geometry used to create the denormalized extent. The geometry should be a polygon, polyline, or a multipoint geometry. This method returns
null
if a point or a multipoint with only one point is used as the input geometry. It returns a cloned extent if an extent is used as the input geometry.ReturnsExample// create an extent that goes over the dateline // as the points are cross the dateline const multipoint = new Multipoint({ points: [ [158.6082458495678, 59.91028747107214], [-145.98220825200923, 60.23981116998903] ] }); const extent = normalizeUtils.getDenormalizedExtent(multipoint);
-
normalizeCentralMeridian
normalizeCentralMeridian(geometries, url, requestOptions){Promise<Array<(GeometryUnion|Mesh|null|undefined)>>}
-
Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the coordinate system of the view. Only supported for Web Mercator and WGS84 spatial references.
Parametersgeometries Array<(GeometryUnion|Mesh|null|undefined)>|GeometryUnion|MeshAn array of geometries to normalize.
optional A geometry service URL used to perform the normalization. If this value is
null
then the default geometry service URL in esriConfig.geometryServiceUrl is used.requestOptions RequestOptionsoptionalAdditional options to be used for the data request.
ReturnsType Description Promise<Array<(GeometryUnion|Mesh|null|undefined)>> Resolves to an array of the normalized geometries. Example// create a non-normalized line that crosses the dateline const polyline = new Polyline({ paths: [ [170, 52.68], [190, 49.5] ] }); normalizeUtils.normalizeCentralMeridian([polyline]) .then(function(polylines){ // returns a line representing the same geometry, but // now is normalized between -180 and 180 on the x-coordinate. // but represents the same feature const graphic = new Graphic({ geometry: polylines[0], symbol: { type: "simple-line" } });