sanitize_geojson#
- 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:
Removal of features without geometries.
Coordinate transformation to pixel coordinates.
Splitting of multi-part geometries e.g. MultiPolygon –> Polygons.
(Optional) If to_map_coords=true, transformation back to map coordinates.
- Parameters:
geojson (dict) – A GeoJSON-like mapping of a FeatureCollection.
crs_transformer (CRSTransformer) – A CRS transformer for coordinate transformation.
to_map_coords (bool) – If True, transform geometries back to map coordinates before returning. Defaults to False.
- Returns:
Transformed FeatureCollection.
- Return type: