Projection Format Conversion Tools

The stems.gis.projections module contains tools to help convert between representations of projections, including between the Open Geospatial Consortium (OGC) and the Climate Forecast (CF) convention systems.

There are also functions that help retrieve useful information from a Rasterio rasterio.crs.CRS, including the “long name” (e.g., "WGS 84 / Pseudo-Mercator")

crs_longname(crs)

Return name of a CRS / ellipsoid pair

Climate Forecast (CF) Parameters

The following functions are useful for retrieving CF parameters from rasterio.crs.CRS representations of coordinate reference systems:

cf_crs_name(crs)

Return CF name of a CRS projection

cf_crs_attrs(crs)

Return CF-compliant CRS info to prevent “unknown” CRS/Ellipse/Geoid

cf_proj_params(crs)

Return projection parameters for a CRS

cf_ellps_params(crs)

Return ellipsoid parameters for a CRS

cf_xy_coord_names(crs)

Returns appropriate names for coordinates given CRS

These functions rely on a few data variables that contain the translations between the OGC and CF systems:

CF_CRS_NAMES

Built-in immutable sequence.

CF_PROJECTION_NAMES

Mapping between OGC WKT <-> CF projection names

CF_ELLIPSOID_DEFS

mapping from CF ellipsoid parameter to SpatialReference method calls

CF_PROJECTION_DEFS

Mapping between CF <-> OGC WKT projection parameters for projections

EPSG Codes

You can also try to retrieve the European Petroleum Survey Group (EPSG) code from a rasterio.crs.CRS:

epsg_code(crs)

Return EPSG code for a CRS