lair.geo.CRS#

class lair.geo.CRS(crs)[source]#

Coordinate Reference System (CRS) class.

This class is a wrapper around the pyproj.CRS class, with additional methods for converting to other CRS classes.

See https://pyproj4.github.io/pyproj/stable/crs_compatibility.html#cartopy for more information.

Note

osgeo, fiona, and pycrs conversions have not been implemented.

Parameters:

crs (Any) – The CRS: another CRS, an EPSG code (4326), an "EPSG:..." string, a cartopy, pyproj or rasterio CRS, or anything pyproj.CRS.from_user_input reads (a PROJ string, WKT).

Variables:

crs (pyproj.CRS) – Pyproj CRS object

See also

write_rio_crs

Writes a CRS to xarray data.

Examples

>>> from lair.geo import CRS
>>> CRS("EPSG:4326").epsg
4326
>>> CRS(4326).to_pyproj().name
'WGS 84'

Attributes

epsg

Get the EPSG code of the CRS.

proj4

Get the PROJ4 string of the CRS.

units

Get the units of the CRS.

wkt

Get the WKT string of the CRS.

Methods

to_cartopy()

Convert to cartopy CRS.

to_pyproj()

Convert to pyproj CRS.

to_rasterio()

Convert to rasterio CRS.