vibeproj.crs

CRS resolution — extract projection type and parameters from EPSG codes.

Uses pyproj for CRS metadata extraction, then maps to our internal projection types.

Attributes

Classes

ProjectionParams

Parameters extracted from a CRS needed to configure a projection.

Functions

parse_crs_input(→ pyproj.CRS)

Parse a CRS input to a pyproj CRS object.

resolve_projection_params(→ ProjectionParams)

Extract projection parameters from a CRS.

resolve_transform(→ tuple[ProjectionParams, ...)

Resolve source and target CRS for a coordinate transform.

extract_helmert(src_crs, dst_crs)

Extract Helmert 7-parameter datum shift between two CRS.

Module Contents

type vibeproj.crs.CRSInput = int | str | tuple[str, int] | CRS
class vibeproj.crs.ProjectionParams

Parameters extracted from a CRS needed to configure a projection.

projection_name: str
ellipsoid: vibeproj.ellipsoid.Ellipsoid
lon_0: float = 0.0
lat_0: float = 0.0
lat_1: float = 0.0
lat_2: float = 0.0
k_0: float = 1.0
x_0: float = 0.0
y_0: float = 0.0
utm_zone: int = 0
south: bool = False
north_first: bool = False
extra: dict[str, Any]
vibeproj.crs.parse_crs_input(crs_input: CRSInput) pyproj.CRS

Parse a CRS input to a pyproj CRS object.

Accepts: - An EPSG integer code: 4326 - An authority string: “EPSG:4326” or “epsg:4326” - A tuple: (“EPSG”, 4326) - A pyproj CRS object

vibeproj.crs.resolve_projection_params(crs: pyproj.CRS) ProjectionParams

Extract projection parameters from a CRS.

Returns a ProjectionParams object describing the projection type and its parameters. For geographic CRS (lat/lon), returns projection_name=”longlat”.

vibeproj.crs.resolve_transform(crs_from: CRSInput, crs_to: CRSInput) tuple[ProjectionParams, ProjectionParams, pyproj.CRS, pyproj.CRS]

Resolve source and target CRS for a coordinate transform.

Returns (src_params, dst_params, src_crs, dst_crs).

vibeproj.crs.extract_helmert(src_crs: pyproj.CRS, dst_crs: pyproj.CRS)

Extract Helmert 7-parameter datum shift between two CRS.

Uses pyproj to determine the best available transformation pipeline, then extracts the Helmert operation parameters from the PROJ pipeline string.

Returns

HelmertParams or None

None if same datum, no Helmert available, or identity transform.