require(["esri/geometry/operators/simplifyOperator"], (simplifyOperator) => { /* code goes here */ });
import * as simplifyOperator from "@arcgis/core/geometry/operators/simplifyOperator.js";
esri/geometry/operators/simplifyOperator
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
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
execute(geometry){GeometryUnion |null |undefined}
-
Performs the simplify operation on a single geometry.
Parametergeometry GeometryUnionThe geometry to be simplified.
ReturnsType 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
executeMany(geometries){Array<(GeometryUnion|null|undefined)>}
-
Performs the simplify operation on the geometry set.
Parametergeometries GeometryUnion[]The array of geometries to be simplified, All the geometries must have the same spatial reference.
ReturnsType Description Array<(GeometryUnion|null|undefined)> Returns an array whose elements may either be simplified geometries or null.
-
isSimple
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.
Parametergeometry GeometryUnionThe input geometry.
ReturnsType 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