API Reference

This is the auto-generated API reference documentation.

Public functions

reproject_geometry.reproject.reproject_geometry(geojson: Dict[str, Any], src_crs: str, dst_crs: str, dst_tolerance: float | None = None, precision: int = 3) Dict[str, Any][source]

Reprojects a GeoJSON-like geometry from a source to destination CRS with the option to limit reprojection error to approximately dst_tolerance.

If dst_tolerance is specified, additional vertices are inserted into the geometry polygon(s) prior to reprojection to capture projection distortion. The projected geometries are then simplified by removing vertices until the simplificaton imparts an error that exceeds dst_tolerance. The supplied dst_tolerance must be in the linear unit (e.g., meters, feet, degrees) of the destination CRS.

Parameters:
  • geojson (Dict[str, Any]) – A GeoJSON-like dictionary containing a polygon or multipolygon to be reprojected.

  • src_crs (str) – Source CRS string, e.g., an EPSG code or WKT2.

  • dst_crs (str) – Destination CRS string.

  • dst_tolerance (float, optional) – Maximum acceptable “error” of the reprojected Polygon(s) in the destination CRS. Must be in the linear unit of the destination CRS.

  • precision (int, optional) – The number of decimal places to include in the coordinates for the reprojected geometry. Defaults to 3 decimal places.

Returns:

A GeoJSON-like dictionary containg the reprojected

Polygon(s).

Return type:

Dict[str, Any]

reproject_geometry.reproject.reproject_multipolygon(multipolygon: MultiPolygon, src_crs: str, dst_crs: str, dst_tolerance: float | None = None, precision: int = 3) MultiPolygon[source]

Reprojects each polygon in a multipolygon from a source to destination CRS with the option to limit reprojection error to approximately dst_tolerance.

If dst_tolerance is specified, additional vertices are inserted into the geometry polygon(s) prior to reprojection to capture projection distortion. The projected geometries are then simplified by removing vertices until the simplificaton imparts an error that exceeds dst_tolerance. The supplied dst_tolerance must be in the linear unit (e.g., meters, feet, degrees) of the destination CRS.

Parameters:
  • multipolygon (MultiPolygon) – The multipolygon to be reprojected.

  • src_crs (str) – Source CRS string, e.g., an EPSG code or WKT2.

  • dst_crs (str) – Destination CRS string.

  • dst_tolerance (float, optional) – Maximum acceptable “error” of the reprojected Polygon(s) in the destination CRS. Must be in the linear unit of the destination CRS.

  • precision (int, optional) – The number of decimal places to include in the coordinates for the reprojected geometry. Defaults to 3 decimal places.

Returns:

The reprojected multipolygon.

Return type:

MultiPolygon

reproject_geometry.reproject.reproject_polygon(polygon: Polygon, src_crs: str, dst_crs: str, dst_tolerance: float | None = None, precision: int = 3) Polygon[source]

Reprojects a polygon from a source to destination CRS with the option to limit reprojection error to approximately dst_tolerance.

If dst_tolerance is specified, additional vertices are inserted into the geometry polygon(s) prior to reprojection to capture projection distortion. The projected geometries are then simplified by removing vertices until the simplificaton imparts an error that exceeds dst_tolerance. The supplied dst_tolerance must be in the linear unit (e.g., meters, feet, degrees) of the destination CRS.

Parameters:
  • polygon (Polygon) – The polygon to be reprojected.

  • src_crs (str) – Source CRS string, e.g., an EPSG code or WKT2.

  • dst_crs (str) – Destination CRS string.

  • dst_tolerance (float, optional) – Maximum acceptable “error” of the reprojected Polygon(s) in the destination CRS. Must be in the linear unit of the destination CRS.

  • precision (int, optional) – The number of decimal places to include in the coordinates for the reprojected geometry. Defaults to 3 decimal places.

Returns:

The reprojected polygon.

Return type:

Polygon