Geometry centroid

Supported in: Batch, Streaming

Return the centroid, or "center of mass", of the geometry using a spherical approximation of the globe. If the geometry is a collection of mixed dimensions, only the elements of the highest dimension will contribute to the centroid (e.g. in a collection of points, lines and polygons, points and lines are ignored).

Expression categories: Geospatial

Declared arguments

  • Expression - Valid GeoJSON input.
    Expression<Geometry>

Output type: GeoPoint

Examples

Example 1: Base case

Argument values:

  • Expression: geometry
geometryOutput
{"type":"Polygon","coordinates":[[[-1.0,-1.0],[1.0,-1.0],[1.0,1.0],[-1.0,1.0],[-1.0,-1.0]]]}{
latitude: 0.0,
longitude: 0.0,
}
{"type":"LineString","coordinates":[[30.0,0.0],[35.0,0.0],[50.0,0.0]]}{
latitude: 0.0,
longitude: 40.0,
}
{"type":"MultiPoint","coordinates":[[0.0,0.0],[0.0,1.0]]}{
latitude: 0.5,
longitude: 0.0,
}
{"type":"MultiPoint","coordinates":[[160.0,0.0],[-170.0,0.0]]}{
latitude: 0.0,
longitude: 175.0,
}
{"type":"GeometryCollection","geometries":[{"type":"Polygon","coordinates":[[[0.0,-0.017981],[0.0017...{
latitude: 0.0,
longitude: 0.0,
}
nullnull