getCentroid method

Point getCentroid()

Computes the centroid of this Geometry. The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).

The centroid of an empty geometry is POINT EMPTY.

@return a {@link Point} which is the centroid of this Geometry

Implementation

Point getCentroid() {
  if (isEmpty()) return geomFactory.createPointEmpty();
  Coordinate? centPt = Centroid.getCentroidStatic(this);
  return createPointFromInternalCoord(centPt!, this);
}