import { execute, executeMany, supportsCurves } from "@arcgis/core/geometry/operators/generalizeOperator.js";const { execute, executeMany, supportsCurves } = await $arcgis.import("@arcgis/core/geometry/operators/generalizeOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Generalizes 2D geometries using Douglas-Peucker algorithm.

Type definitions
Options
removeDegenerateParts
Preserves 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.
- Default value
- false
unit
- Type
- LengthUnit | undefined
The length unit of maxDeviation.
The default is the input geometry's spatial reference unit.
An error will be thrown if this is set for Geographic Coordinate Systems.
Functions
| Name | Return Type | Object |
|---|---|---|
| | |
| | ||
| | ||
| |
execute
Performs the generalize operation on the input geometry.
- Signature
-
execute (geometry: GeometryUnion, maxDeviation: number, options?: Options): GeometryWithoutMeshUnion | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry to be generalized. | | |
| maxDeviation | The maximum allowed deviation from the generalized geometry to the original geometry.
If maxDeviation <= 0 the operator returns the input geometry.
Unless the | | |
| options | Additional options. | |
- Returns
- GeometryWithoutMeshUnion | null | undefined
Returns the generalized geometry or null.
Example
// Generalize a polyline geometryconst generalizedPolyline = generalizeOperator.execute(polyline, 10); executeMany
Performs the generalize operation on the input geometries.
- Signature
-
executeMany (geometries: GeometryUnion[], maxDeviation: number, options?: Options): GeometryWithoutMeshUnion[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometries | The input geometries to be generalized. All the geometries must have the same spatial reference. | | |
| maxDeviation | The 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 | | |
| options | Additional options. | |
- Returns
- GeometryWithoutMeshUnion[]
Returns an array of generalized geometries. Geometries with a dimension of < 1 are simply passed along.
Variables
supportsCurves
Indicates if the operator supports input geometries that contain curves.
The value will always be true. This will produce densified output geometries.
- Type
- boolean