CrsReference

class geodetic_engine.persistablereference.CrsReference[source]

Bases: Reference

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

wkt

The ESRI WKT of the CRS itself. For a bound reference this is the nested late bound CRS’s WKT when supplied, regardless of any top-level WKT.

late_bound

The CRS being bound, when this reference binds one.

operation

The transformation it is bound by, when it binds one.

property is_bound: bool

Whether the reference carries the transformation to its hub.

to_crs()[source]

Build the CRS this reference states.

Return type:

CRS

Returns:

The CRS, as a BoundCRS when the reference binds a transformation to it.

Raises:
  • MalformedReferenceError – If the reference states no WKT, or PROJ will not read it, or the bound operation’s source CRS does not match the base geodetic CRS.

  • UnsupportedMethodError – If the bound transformation states a method this package will not translate.

  • UnembeddableOperationError – If the bound transformation cannot be stated as the single step a bound CRS carries.

to_bound_crs(operation)[source]

Build this CRS bound to a transformation stated by a separate payload.

An OSDU catalogue publishes a CRS and a coordinate transformation as records of their own, and a record that uses them names both. Binding them here gives the same thing an early bound payload states in one piece: a CRS that carries its own datum shift, leaving nothing for a caller to disambiguate later.

Parameters:

operation (OperationReference) – The transformation to bind, as parse_persistable_reference() returns for an ST or CT payload. A parsed reference is the only thing accepted. An authority code, a CRS name or PROJJSON would each have to be resolved against a register, and this package reads the parameters a payload carries rather than looking up what a code is meant to stand for.

Return type:

CRS

Returns:

The bound CRS.

Raises:
  • ValueError – If this reference already states a transformation of its own. Binding a second would discard the first in silence.

  • MalformedReferenceError – If the operation’s source CRS does not match this CRS’s geodetic base (ignoring axis order), or PROJ will not assemble the two. Reversed operations must be explicitly inverted before binding.

  • UnsupportedMethodError – If the transformation states a method this package will not translate.

  • UnembeddableOperationError – If it cannot be stated as the single step a bound CRS carries.

Example

>>> crs = parse_persistable_reference(crs_payload)
>>> shift = parse_persistable_reference(ct_payload)
>>> crs.to_bound_crs(shift).is_bound
True
__init__(raw, kind, name, authority_code, version, wkt, late_bound, operation)