Centroid - ObjectVision/GeoDMS GitHub Wiki

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

⚠️ **GitHub.com Fallback** ⚠️