centroid#

geodesic.boson.centroid(input_collection=None, output_collection=None)[source]#

Calculate the centroid of the queried geometry.

This middleware will calculate the centroid of the geometry and return it in a new collection called “centroid”. In the case of multi-geometries, the centroid of the entire geometry will be calculated.

When creating this middleware, most of the time you will want to apply it after any filtering happens, so that the centroid is calculated on the filtered geometry.

Parameters:
  • input_collection (str, optional) – name of the input collection to apply transform to. Defaults to None (all collections)

  • output_collection (str, optional) – name of the virtual collection that the transform will be applied to. Defaults to None (no virtual collection created)

Returns:

middleware to calculate the centroid of the queried geometry

Return type:

Middleware

Examples

>>> # Add the centroid middleware to a dataset view
>>> ds_with_centroid = ds.view(
...     middleware=[
...         centroid()
...     ]
... )