s2#

geodesic.boson.s2(level, return_all=False, input_collection=None, output_collection=None)[source]#

Adds the S2 cell to properties.

See http://s2geometry.io/devguide/s2cell_hierarchy.html for more details.

Defaults to returning the S2 cell of the centroid of the geometry

If return_all is set to True, will return a list of the S2 cells that cover the geometry

Adds a property to the feature properties called “s2_[level]” where [level] is the level of the S2 cell.

If return_all is set to True, will return a list of the S2 cells that cover the geometry, in a property called “s2_[level]_all”.

Parameters:
  • level (int) – S2 level. Must be between 0 and 30

  • return_all (bool) – whether to return all S2 cells that cover the geometry. Defaults to False

  • 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 add S2 cell to feature properties

Return type:

Middleware

Examples

>>> # Add the S2 cell to the properties of the search response
>>> transform = s2(level=10)