require(["esri/geometry/operators/generalizeOperator"], (generalizeOperator) => { /* code goes here */ });
import * as generalizeOperator from "@arcgis/core/geometry/operators/generalizeOperator.js";
esri/geometry/operators/generalizeOperator
Generalizes 2D geometries using Douglas-Peucker algorithm.
Property Overview
Name | Type | Summary | Object |
---|---|---|---|
Indicates if the operator supports input geometries that contain curves. | generalizeOperator |
Property Details
-
supportsCurves
supportsCurves Booleanreadonly
-
Indicates if the operator supports input geometries that contain curves. This will produce densified output geometries.
- Default Value:true
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Performs the generalize operation on the input geometry. | generalizeOperator | ||
Performs the generalize operation on the input geometries. | generalizeOperator |
Method Details
-
execute
execute(geometry, maxDeviation, options){GeometryUnion |null |undefined}
-
Performs the generalize operation on the input geometry.
ParametersSpecificationgeometry GeometryUnionThe input geometry to be generalized.
maxDeviation NumberThe maximum allowed deviation from the generalized geometry to the original geometry. If maxDeviation <= 0 the operator returns the input geometry. Unless the
unit
option is set, the default is the spatial reference unit ofgeometry
.options ObjectoptionalAdditional options.
SpecificationremoveDegenerateParts BooleanoptionalDefault Value: falsePreserves degenerate parts. The operator will try to output three distinct vertices for closed polyline paths and polygon rings, and it will output two distinct vertices for open polyline paths.
When set to
true
, the degenerate parts of the geometry will be removed from the output. This may not be desirable for displaying the geometry.unit LengthUnitoptionalThe length unit of
maxDeviation
. An error will be thrown if this is set for Geographic Coordinate Systems.ReturnsType Description GeometryUnion | null | undefined Returns the generalized geometry or null. Example// Generalize a polyline geometry const generalizedPolyline = generalizeOperator.execute(polyline, 10);
-
executeMany
executeMany(geometries, maxDeviation, options){GeometryUnion[]}
-
Performs the generalize operation on the input geometries.
ParametersSpecificationgeometries GeometryUnion[]The input geometries to be generalized. All the geometries must have the same spatial reference.
maxDeviation NumberThe maximum allowed deviation from the generalized geometry to the original geometry. If the value is less than or equal to zero, then the operator returns the input geometries. Unless the
unit
option is set, the default is the spatial reference unit ofgeometries
.options ObjectoptionalAdditional options.
SpecificationremoveDegenerateParts BooleanoptionalDefault Value: falsePreserves degenerate parts. The operator will try to output three distinct vertices for closed polyline paths and polygon rings, and it will output two distinct vertices for open polyline paths.
When set to
true
, the degenerate parts of the geometries will be removed from the output. This may not be desirable for displaying the geometries.unit LengthUnitoptionalThe length unit of
maxDeviation
. An error will be thrown if this is set for Geographic Coordinate Systems.ReturnsType Description GeometryUnion[] Returns an array of generalized geometries. Geometries with a dimension of < 1 are simply passed along.