Skip to content

crs

Metric-CRS checks.

quakecascade.crs

Metric coordinate reference system checks.

Every distance in the package is computed in a projected CRS with metre units. Callers state the CRS; when they pass geographic coordinates the library can estimate the local UTM zone, but it never measures in degrees.

CRSError

Bases: ValueError

Raised when an operation needs metric coordinates and does not get them.

as_crs

as_crs(crs)

Parse an EPSG code, WKT, PROJ string or pyproj.CRS; None raises CRSError.

is_metric

is_metric(crs)

True for a projected CRS whose first axis is in metres.

require_metric

require_metric(crs, what='this operation')

Return crs as a pyproj.CRS if it can measure metres, else raise CRSError.

The CRS must be projected with metre units, and not a (pseudo-)Mercator projection such as EPSG:3857 or EPSG:3395, whose distances are inflated by 1 / cos(latitude) (about +28 % at 38 degrees north). what names the caller in the error message.

estimate_utm_crs

estimate_utm_crs(lon, lat)

WGS 84 / UTM zone covering the median of lon/lat (degrees).

frame_crs

frame_crs(obj)

CRS of a GeoDataFrame/GeoSeries, or None for plain objects.

ensure_metric_frame

ensure_metric_frame(gdf, what='this operation')

Return gdf unchanged if metric, else raise. GeoDataFrames only.