normalizeUtils

require(["esri/geometry/support/normalizeUtils"], function(normalizeUtils) { /* code goes here */ });
Object: esri/geometry/support/normalizeUtils
Since: ArcGIS API 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.

Method Overview

NameReturn TypeSummaryObject
Promise<Geometry[]>

Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the coordinate system of the view.

more details
more detailsnormalizeUtils

Method Details

normalizeCentralMeridian(geometries, geometryService, requestOptions){Promise<Geometry[]>}

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.

Parameters:
geometries Geometry[]

An array of geometries to normalize.

geometryService GeometryService
optional

A geometry service used to perform the normalization. If this value is null then the default geometry service in esriConfig.geometryServiceUrl is used.

requestOptions Object
optional

Additional options to be used for the data request.

Returns:
TypeDescription
Promise<Geometry[]>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" }
    });

API Reference search results

NameTypeModule
Loading...