Centroid_or_mid
Geometric functions centroid_or_mid

syntax
- centroid_or_mid(polygon_data_item)
definition
centroid_or_mid(polygon_data_item) results in a Point Data item with
- the Centroid if it is located in the Polygon
- or else the mid of the polygon_dataitem Argument. The mid of a polygon is calculated as the middle point of the coordinates of the polygon in such a way that it is always located within the polygon. See here for a description.
description
The centroid_or_mid function results in the centroid if it is located within the polygon or else in the mid of the polygon. This means the result of the centroid_or_mid is always located within the polygon, or at its border such that Point_in_polygon would return true.
In the image above the centroid is not located within the polygon. The centroid_or_mid function will still result in a point within the polygon.
applies to
data item polygon_dataitem with fpoint or dpoint Value type and composition type polygon.
example
attribute<point_rd> centroid_or_mid (district) := centroid_or_mid(district/geometry);
| district/geometry | centroid_or_mid |
|---|---|
| {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