stems.gis.utils module

Assorted GIS utilities

stems.gis.utils.crs2osr(crs)[source]

Return osgeo.osr.SpatialReference of a rasterio.crs.CRS

Parameters

crs (rasterio.crs.CRS) – Rasterio coordinate reference system

Returns

CRS as OSR object

Return type

osr.SpatialReference

stems.gis.utils.osr_same_crs(*crs)[source]

Use OSR to compare for CRS equality

Converts Rasterio CRS to OSRSpatialReference and compares using OSR because comparing CRS from WKT with CRS from EPSG/Proj4 can be buggy.

Parameters

*crs (rasterio.crs.CRS) – Two or more CRS

Returns

True if all CRS are equivalent

Return type

bool

stems.gis.utils.same_crs(*crs)[source]

Check if multiple CRS are the same

Parameters

crs (rasterio.crs.CRS) – Multiple CRS to compare

Returns

True if all of the CRS inputs are the same (according to rasterio)

Return type

bool

See also

osr_same_crs()