offsetOperator

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

Offset 2D geometries. The offset operation creates a geometry that is a constant distance from an input polyline or polygon. It is similar to buffering, but produces a one-sided result. If offset distance is greater than 0, then the offset geometry is constructed to the right of the oriented input geometry, otherwise it is constructed to the left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counterclockwise. So the right side of a simple polygon is always its inside. The miter limit is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.

Method Overview

Name Return Type Summary Object

Creates an offset version of the input geometry.

offsetOperator

Creates offset versions of the input geometries.

offsetOperator

Method Details

execute

Method
execute(geometry, distance, options){Geometry}

Creates an offset version of the input geometry. This is not applicable to point geometries.

Parameters
Specification
geometry Geometry

The input geometry. Can be an extent, polyline, or polygon. Point and multipoint geometries are not supported.

distance Number

The distance to offset the input geometry. Unless the unit option is set, the default is the geometry's spatial reference unit.

options Object
optional

Additional options.

Specification
flattenError Number
optional
Default Value: 0

The maximum distance of the resulting segments compared to the true circular arc (used only when joins is set to "round"). The algorithm never produces more than around 180 vertices for each round join.

joins String
optional
Default Value: "round"

Defines the join type of the offset geometry.

Possible Values:"round"|"miter"|"bevel"|"square"

miterLimit Number
optional
Default Value: 10

Defines when miter joins are replaced with bevel joins.

unit LengthUnit
optional

The length unit of the offset distance. An error will be thrown if this is set for Geographic Coordinate Systems.

Returns
Type Description
Geometry Returns the offset geometry.
Example
// Create an offset polygon.
const offsetPolygon = offsetOperator.execute(polygon, 100);

executeMany

Method
executeMany(geometries, distance, options){Geometry[]}

Creates offset versions of the input geometries.

Parameters
Specification
geometries Geometry[]

The set of input geometries. Can be extents, polylines, or polygons. Point and multipoint geometries are not supported.

distance Number

The distance to offset the input geometries. Unless the unit option is set, the default is the geometries spatial reference unit.

options Object
optional

Additional options.

Specification
flattenError Number
optional
Default Value: 0

The maximum distance of the resulting segments compared to the true circular arc (used only when joins is round). The algorithm never produces more than around 180 vertices for each round join.

joins String
optional
Default Value: "round"

Defines the join type of the offset geometry.

Possible Values:"round"|"miter"|"bevel"|"square"

miterLimit Number
optional
Default Value: 10

Defines when miter joins are replaced with bevel joins.

unit LengthUnit
optional

The length unit of the offset distance. An error will be thrown if this is set for Geographic Coordinate Systems.

Returns
Type Description
Geometry[] Returns an array of offset geometries.

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