simplifyOperator

AMD: require(["esri/geometry/operators/simplifyOperator"], (simplifyOperator) => { /* code goes here */ });
ESM: import * as simplifyOperator from "@arcgis/core/geometry/operators/simplifyOperator.js";
Object: esri/geometry/operators/simplifyOperator
Since: ArcGIS Maps SDK for JavaScript 4.31

Simplifies 2D geometries by removing unnecessary vertices while preserving the geometry shape. This makes them topologically legal with respect to their geometry type.

Property Overview

Name Type Summary Object

Indicates if the operator supports input geometries that contain curves.

simplifyOperator

Property Details

supportsCurves

Property
supportsCurves Booleanreadonly

Indicates if the operator supports input geometries that contain curves.

Default Value:true

Method Overview

Name Return Type Summary Object

Performs the simplify operation on a single geometry.

simplifyOperator

Performs the simplify operation on the geometry set.

simplifyOperator

Indicates if the given geometry is non-OGC topologically simple.

simplifyOperator

Method Details

execute

Method
execute(geometry){GeometryUnion |null |undefined}

Performs the simplify operation on a single geometry.

Parameter
geometry GeometryUnion

The geometry to be simplified.

Returns
Type Description
GeometryUnion | null | undefined Returns the simplified geometry or null.
Example
// Topologically simplifies a geometry
const simplified = simplifyOperator.execute(polyline);
console.log(simplifyOperator.isSimple(simplified)); // true

executeMany

Method
executeMany(geometries){Array<(GeometryUnion|null|undefined)>}

Performs the simplify operation on the geometry set.

Parameter
geometries GeometryUnion[]

The array of geometries to be simplified, All the geometries must have the same spatial reference.

Returns
Type Description
Array<(GeometryUnion|null|undefined)> Returns an array whose elements may either be simplified geometries or null.

isSimple

Method
isSimple(geometry){Boolean}

Indicates if the given geometry is non-OGC topologically simple. This operation takes into account z-values.

Point geometries are always simple. Multipoint geometries cannot have any points with exactly equal x and y. The tolerance is not taken into account.

Polyline geometries can have self-intersecting paths, however they cannot have degenerate segments. A degenerate segment is a zero-length segment where the start and end points are essentially the same. When the polyline has no z, degenerate segments are those that have a length in the xy plane less than or equal to the tolerance. When the polyline has z, degenerate segments are those that are shorter than the tolerance in the xy plane, and the change in the z-value along the segment is less than or equal to the z-tolerance.

Polygon geometries are considered simple if the following is true:

  • Contains no self-intersecting rings.
  • Exterior rings are clockwise, and interior rings (holes) are counterclockwise.
  • Rings can touch other rings in a finite number of points.
  • Rings can be self-tangent in a finite number of points.
  • Vertices are either exactly coincident, or further than the 2 * sqrt(2) * tolerance from each other.
  • If a vertex is not equal to any boundary point of a segment, it has to be further than sqrt(2) * tolerance from any segment.
  • No segment length is zero.
  • Each path contains at least three non-equal vertices.
  • No empty paths are allowed.
  • Order of rings does not matter.

The tolerance value is obtained from the geometry's spatial reference. If it is null, then a small tolerance value is calculated from the geometry coordinates using double-precision.

Parameter
geometry GeometryUnion

The input geometry.

Returns
Type Description
Boolean Returns true if the geometry is simple, otherwise returns false.
Example
// returns true if given geometry is simple
const simple = simplifyOperator.isSimple(polyline);
console.log(simple); // true | false

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.