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:
- Returns:
middleware to calculate the centroid of the queried geometry
- Return type:
Examples
>>> # Add the centroid middleware to a dataset view >>> ds_with_centroid = ds.view( ... middleware=[ ... centroid() ... ] ... )