import { labelPointExecute, execute, labelPointExecuteMany, executeMany, labelPointSupportsCurves } from "@arcgis/core/geometry/operators/labelPointOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.31

Calculates a label point for the given 2D geometries. The point is guaranteed to be on the interior of the geometry. It can be used to place a label on a feature and help to ensure readability on the map.

Based on the input geometry type, the label point is defined as follows:

  • Extent - the center of the extent.
  • Multipoint - the point which is closest to the center of the geometry's envelope.
  • Point - the point itself.
  • Polygon - a point near the centroid of the ring with greatest area.
  • Polyline - a vertex near the middle of the longest segment.
See also

Functions

labelPointExecute

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Performs the label point operation on the geometry.

Signature
labelPointExecute (geometry: GeometryUnion): Point

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

Returns
Point

Returns the label point.

Example
// Perform the label point operation
const labelPoint = labelPointExecute(polygon);

execute

deprecated Function

Performs the label point operation on the geometry.

Signature
execute (geometry: GeometryUnion): Point

Parameters

ParameterTypeDescriptionRequired
geometry

The input geometry.

Returns
Point

Returns the label point.

Example
// Perform the label point operation
const labelPoint = labelPointExecute(polygon);

labelPointExecuteMany

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Performs the label point operation on the geometry set.

Signature
labelPointExecuteMany (geometries: GeometryUnion[]): Point[]

Parameters

ParameterTypeDescriptionRequired
geometries

The set of input geometries. All the geometries must have the same spatial reference.

Returns
Point[]

Returns the label points for each geometry.

executeMany

deprecated Function

Performs the label point operation on the geometry set.

Signature
executeMany (geometries: GeometryUnion[]): Point[]

Parameters

ParameterTypeDescriptionRequired
geometries

The set of input geometries. All the geometries must have the same spatial reference.

Returns
Point[]

Returns the label points for each geometry.

Variables

labelPointSupportsCurves

Variable
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if the operator supports input geometries that contain curves. The value will always be true.

Type
boolean

supportsCurves

deprecated Variable

Indicates if the operator supports input geometries that contain curves. The value will always be true.

Type
ReturnType