Centroid

Geometric functions centroid

syntax

  • centroid(polygon_data_item)

definition

centroid(polygon_data_item) results in a Point Data item with the centroid of the polygon_data_item Argument.

description

The centroid of a Polygon does not have to be located within the polygon. Use the Centroid_or_mid function to find a point always located within or at the border of that polygon such that Point_in_polygon would return true.

applies to

example

attribute<point_rd> centroid (district) := centroid(district/geometry);
district/geometry centroid
{21: xy(113810; 403025) … xy(113049; 402955)
{17: xy(113269; 400990) … xy(112704; 401159)
{19: xy(115099; 401238) … xy(114017; 401268)

domain district, nr of rows = 3

implementation details

see code from: https://github.com/ObjectVision/GeoDMS/blob/v13/rtc/dll/src/geo/Centroid.h image

see also