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:
parse_persistable_reference()– read a payload into the reference it states.CrsReference– a CRS, on its own or bound to a hub, withto_crs().OperationReference– a transformation, single or concatenated, withto_operation().UnitReference– a unit, withto_si()andfrom_si().looks_like_reference()– whether a string is shaped like one, cheap enough to run on any CRS definition a caller passes in.
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¶
State one coordinate transformation as an ESRI |
|
Whether a string is shaped like a persistableReference. |
|
Build the coordinate operation an ESRI |
|
Read a persistableReference payload. |
|
Write a CRS or transformation as a persistableReference payload. |
Classes¶
An authority and code naming one object. |
|
A coordinate reference system, on its own or bound to a hub. |
|
The kind of definition a persistableReference states. |
|
A coordinate transformation, single or concatenated. |
|
What every persistableReference states about itself. |
|
A unit, stated by how it converts to its SI base. |
Constants and type aliases¶
Exceptions¶
The payload is not a readable persistableReference. |
|
Base class for every persistableReference failure. |
|
A grid-based transformation names a dataset that resolves to no PROJ grid. |
|
A transformation states a method this package will not translate. |
|
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.
One bracketed element of an ESRI WKT definition. |
|
Render an element back to ESRI WKT. |