geodetic_engine.persistablereference

Reading and writing OSDU persistableReference definitions.

OSDU identifies the CRS, transformation or unit of a record with a persistableReference: a JSON envelope wrapping ESRI WKT, frequently URL-encoded, and found as the value of a field in another document – extract that string and pass it here as it is (a payload that has itself been JSON-encoded a second time is not decoded for you). It is self-contained, carrying the full definition rather than a code to look up, and this package reads it that way – the parameters are what is built from, and the authority code beside them is provenance.

Public entry points:

These hand back pyproj objects. from_persistable_reference() is the same thing wrapped in this package’s own CRS type, and transform() accepts a payload directly wherever it accepts a CRS.

A definition this package cannot translate exactly is refused. ESRI states several methods that differ from a supported one only by a convention or a term, so translating a near miss would give coordinates that look right and are metres out.

Example

>>> from geodetic_engine.persistablereference import parse_persistable_reference
>>> reference = parse_persistable_reference(payload)
>>> reference.authority_code
AuthorityCode(authority='OSDU', code='23032023')
>>> reference.to_crs().is_bound
True

Functions

geogtran

State one coordinate transformation as an ESRI GEOGTRAN.

looks_like_reference

Whether a string is shaped like a persistableReference.

operation_from_geogtran

Build the coordinate operation an ESRI GEOGTRAN states.

parse_persistable_reference

Read a persistableReference payload.

to_persistable_reference

Write a CRS or transformation as a persistableReference payload.

Classes

AuthorityCode

An authority and code naming one object.

CrsReference

A coordinate reference system, on its own or bound to a hub.

Kind

The kind of definition a persistableReference states.

OperationReference

A coordinate transformation, single or concatenated.

Reference

What every persistableReference states about itself.

UnitReference

A unit, stated by how it converts to its SI base.

Constants and type aliases

Exceptions

MalformedReferenceError

The payload is not a readable persistableReference.

PersistableReferenceError

Base class for every persistableReference failure.

UnresolvableGridError

A grid-based transformation names a dataset that resolves to no PROJ grid.

UnsupportedMethodError

A transformation states a method this package will not translate.

UnsupportedReferenceError

The payload is well formed but states a kind this package does not model.

Supporting types

Not exported from the subpackage, but returned or accepted by something that is.

esriwkt.Node

One bracketed element of an ESRI WKT definition.

esriwkt.write

Render an element back to ESRI WKT.