import { normalizeCentralMeridian, getDenormalizedExtent } from "@arcgis/core/geometry/support/normalizeUtils.js";const { normalizeCentralMeridian, getDenormalizedExtent } = await $arcgis.import("@arcgis/core/geometry/support/normalizeUtils.js");- Since
- ArcGIS Maps SDK for JavaScript 4.3
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.
Type definitions
Functions
| Name | Return Type | Object |
|---|---|---|
| | |
| | ||
| |
normalizeCentralMeridian
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.
- Signature
-
normalizeCentralMeridian (geometries: (Geometry | null | undefined) | (Geometry | null | undefined)[], url?: string | null, requestOptions?: RequestOptions): Promise<(Geometry | null | undefined)[]>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometries | An array of geometries to normalize. | | |
| url | A geometry service URL used to
perform the normalization. If this value is | | |
| requestOptions | Additional options to be used for the data request. | |
Example
// create a non-normalized line that crosses the datelineconst 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" } }); getDenormalizedExtent
- Since
- ArcGIS Maps SDK for JavaScript 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 Geometry.spatialReference must be Web Mercator or WGS84.
- Signature
-
getDenormalizedExtent (geometry: Polygon | Polyline | Multipoint | Extent | null | undefined): Extent | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The geometry used to create the denormalized extent. The geometry should be
a Polygon, Polyline, or a
Multipoint geometry.
This method returns | |
Example
// create an extent that goes over the dateline// as the points are cross the datelineconst multipoint = new Multipoint({ points: [ [158.6082458495678, 59.91028747107214], [-145.98220825200923, 60.23981116998903] ]});const extent = normalizeUtils.getDenormalizedExtent(multipoint);