parse_persistable_reference¶
- geodetic_engine.persistablereference.parse_persistable_reference(raw)[source]¶
Read a persistableReference payload.
- Parameters:
raw (
str) – The payload, plain or URL-encoded JSON.- Return type:
- Returns:
The reference it states.
- Raises:
MalformedReferenceError – If the payload is not a readable persistableReference.
UnsupportedReferenceError – If it states a kind this package does not model.
Example
>>> import json >>> payload = json.dumps({ ... "type": "LBC", ... "authCode": {"auth": "EPSG", "code": "4326"}, ... "wkt": 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",' ... 'SPHEROID["WGS_1984",6378137.0,298.257223563]],' ... 'PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]', ... }) >>> reference = parse_persistable_reference(payload) >>> reference.kind, str(reference.authority_code) (<Kind.LATE_BOUND_CRS: 'LBC'>, 'EPSG:4326') >>> reference.to_crs().ellipsoid.semi_major_metre 6378137.0