sanitize_geojson(geojson: dict, crs_transformer: CRSTransformer, to_map_coords: bool = False) dict[source]#

Apply some basic transformations (listed below) to a GeoJSON.

The following transformations are applied:

  1. Removal of features without geometries.

  2. Coordinate transformation to pixel coordinates.

  3. Splitting of multi-part geometries e.g. MultiPolygon –> Polygons.

  4. (Optional) If to_map_coords=true, transformation back to map coordinates.

  • geojson (dict) – A GeoJSON-like mapping of a FeatureCollection.

  • crs_transformer (CRSTransformer) – A CRS transformer for coordinate transformation.

  • to_map_coords (bool, optional) – If True, transform geometries back to map coordinates before returning. Defaults to False.


Transformed FeatureCollection.

Return type