Skip to main content

UCRS a single wrapper class that accepts any CRS input and lazily converts to an instance of any library you need (e.g. cartopy, osgeo).

Project description

UCRS - Unified CRS

Working with geospatial data in Python often means juggling multiple libraries, each with its own CRS representation:

  • pyproj uses pyproj.CRS
  • cartopy uses cartopy.crs.CRS and cartopy.crs.Projection
  • GDAL/osgeo uses osgeo.osr.SpatialReference

Converting between these formats is well documented, but a bit tedious.

UCRS solves this by providing a single wrapper class that accepts any CRS input and lazily converts to an instance of any library you need.

Usage

from ucrs import UCRS

# Create UCRS from any CRS representation
ucrs = UCRS(4326)                         # EPSG code
ucrs = UCRS("EPSG:4326")                  # EPSG string
ucrs = UCRS(pyproj.CRS.from_epsg(4326))   # pyproj.CRS
ucrs = UCRS(cartopy.crs.PlateCarree())    # cartopy CRS
ucrs = UCRS(srs)                          # osgeo.osr.SpatialReference

# Access different representations
ucrs.proj        # Always available
ucrs.cartopy     # Requires cartopy
ucrs.osgeo       # Requires GDAL

How It Works

UCRS uses pyproj.CRS as its internal canonical representation. All conversions follow this pattern:

  1. Inputpyproj.CRS (during initialization)
  2. pyproj.CRSOutput format (via cached properties)

Conversions are lazy and cached, so accessing .proj, .cartopy, or .osgeo multiple times returns the same object without re-conversion.

Requirements

  • Python 3.10+
  • pyproj (required)
  • cartopy (optional)
  • GDAL (optional)

Installation

# Minimal installation (pyproj only)
pip install ucrs

# With cartopy support
pip install ucrs[cartopy]

# With GDAL support
pip install ucrs[gdal]

# With all optional dependencies
pip install ucrs[full]

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ucrs-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ucrs-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file ucrs-0.1.1.tar.gz.

File metadata

  • Download URL: ucrs-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.7 Linux/6.17.2-arch1-1

File hashes

Hashes for ucrs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 941533aff2e8262f46e31a299bc84e0ef483f26685fd11a1895781552be93be0
MD5 ca3db8dd64dc4c3a17c1093819a3df72
BLAKE2b-256 48a7c6b5739fef1d61de88c2b5c1a500514bad9fab5fb5c48f2e73a660f76537

See more details on using hashes here.

File details

Details for the file ucrs-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ucrs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.7 Linux/6.17.2-arch1-1

File hashes

Hashes for ucrs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ecee6d2b902a75b0ea068fbbef46652aa358885b0bac543d8093123723e0256d
MD5 7550ab20d17ef070461443ed69856806
BLAKE2b-256 1ae128fca8a1f7ac57d18e71949fe9a45fc1e8586fe7890dc012bc9da2635632

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page