@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
34 lines (32 loc) • 1.7 kB
TypeScript
/**
* Calculates the centroid for a 2D geometry. The centroid represents the geometric center of mass,
* where the mass is equally distributed at each point/vertex of the geometry.
* For example, the centroid of a straight line is the midpoint. The centroid of a point is the point itself.
* It is not guaranteed to be within or on the geometry. The centroid of a donut polygon is
* the center of the hole, which is outside the polygon. The centroid of a curved polyline is not located on the line itself, but will be some distance away from it.
*
* 
*
* @since 4.31
* @see [labelPointOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/labelPointOperator/)
* @see [Sample - Geometry operator - centroid analysis](https://developers.arcgis.com/javascript/latest/sample-code/geometry-operator-centroid/)
* @see [Centroid - wikipedia](https://en.wikipedia.org/wiki/Centroid)
*/
import type Point from "../Point.js";
import type { GeometryUnion } from "../types.js";
/**
* Performs the centroid operation on a geometry.
*
* @param geometry - The geometry in which to calculate the centroid.
* @returns The centroid of the geometry.
* @example
* // Return the centroid of a polygon
* const centroid = centroidOperator.execute(polygon);
* console.log(`x: ${centroid.x}, y: ${centroid.y}`);
*/
export function execute(geometry: GeometryUnion): Point;
/**
* Indicates if the operator supports input geometries that contain curves.
* The value will always be `true`.
*/
export const supportsCurves: boolean;