public final Geometry centroid() throws GeometryException {
    return centroid != null ? centroid : (centroid =
      canBePolygon() ? polygon().getCentroid() :
        canBeLine() ? line().getCentroid() :
        worldGeometry().getCentroid());
  }
Returns and caches {@link Geometry#getCentroid()} of this geometry in world web mercator coordinates.
planetiler-core/src/main/java/com/onthegomap/planetiler/geo/WithGeometry.java