import { isLoaded, load, execute, executeMany, supportsCurves } from "@arcgis/core/geometry/operators/geodesicBufferOperator.js";const { isLoaded, load, execute, executeMany, supportsCurves } = await $arcgis.import("@arcgis/core/geometry/operators/geodesicBufferOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Geodesically buffer 2D geometries. A geodesic buffer creates an area around a geometry by calculating the shortest distance between points on the curved surface of the Earth, minimizing the distortion caused by map projections. This results in a more accurate buffer when applied over larger geographic areas such as those covering multiple UTM zones, or when using global scales.
Notes
Verify that isLoaded() returns true before using this module.
Use load() to load this module's dependencies.
Type definitions
ExecuteOptions
curveType
- Type
- GeodeticCurveType | undefined
The type of geodetic curve used to determine the buffer.
- Default value
- "geodesic"
maxDeviation
The deviation offset to use for convergence.
Unless the unit option is set, the default is meters.
The geodesic arcs of the resulting buffer will be closer than the max deviation of the true buffer.
The default value of NaN will be a maximum of 0.01 meters and (up-to) 0.2% of the buffer distance.
- Default value
- NaN
unit
- Type
- LengthUnit | undefined
The length unit of the buffer distances and max deviation.
- Default value
- "meters"
Functions
| Name | Return Type | Object |
|---|---|---|
| | |
| | |
| | ||
| | ||
| | ||
Polygon[] | | |
| |
isLoaded
Indicates if all dependencies of this module have been loaded.
- Signature
-
isLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
load
Loads this module's dependencies. This method must be called first if isLoaded returns false.
- See also
- Signature
-
load (): Promise<void>
execute
Creates a geodesic buffer around the input geometry.
- Signature
-
execute (geometry: GeometryUnion, distance: number, options?: ExecuteOptions): Polygon | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The geometry to buffer. | | |
| distance | The buffer distance for the geometry. Unless the | | |
| options | Additional options. | |
Example
if (!geodesicBufferOperator.isLoaded()) { await geodesicBufferOperator.load();}
// Calculate the buffer of a polyline geometryconst bufferGeometry = geodesicBufferOperator.execute(polyline, 100); executeMany
Creates a geodesic buffer around the input geometries.
- Signature
-
executeMany (geometries: GeometryUnion[], distances: number[], options?: ExecuteManyOptions): Polygon[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometries | The set of geometries to buffer. All the geometries must have the same spatial reference. | | |
| distances | number[] | The buffer distance for each of the geometries. Unless the | |
| options | Additional options. | |
- Returns
- Polygon[]
Returns the buffered geometries.