OperationRequest

class geodetic_engine.geodesy.OperationRequest[source]

Bases: object

A caller’s request for a particular coordinate operation.

Either an authority code or a name, never a substring of either – or the operation itself, when a payload stated it outright rather than naming it.

text

The reference as the caller wrote it.

auth_name

Authority, when the reference is an authority code.

code

Code, when the reference is an authority code.

name

Operation name, when the reference is not an authority code.

definition

The operation itself, when it was stated rather than named. Excluded from equality so that a request stays hashable whatever PROJ’s own objects do.

classmethod stated(operation)[source]

A request for an operation supplied outright.

No authority code is recorded even when the definition carries one: the code would invite a lookup, and what has to be applied is this object, whose parameters need not agree with whatever a register publishes under the same code.

Return type:

OperationRequest

classmethod parse(reference)[source]

Parse an operation reference.

Parameters:

reference (str | int | OperationCandidate | StatedOperation) – "EPSG:15670", a bare EPSG code such as 15670, an OGC URN such as "urn:ogc:def:coordinateOperation:EPSG::15670", an operation name such as "ITRF2014 to ETRF2014 (1)", an OperationCandidate from available_operations() (its authority_code is used when it has one, its name otherwise – the latter is the only way to pin down a candidate PROJ built with no EPSG id of its own), or an operation stated outright: an OSDU persistableReference payload, an ESRI GEOGTRAN, or anything that builds one through StatedOperation. A stated operation is applied as given rather than looked up.

Return type:

OperationRequest

Returns:

The parsed request.

Raises:

ValueError – If given an OperationCandidate that no single reference can name, because PROJ assembled it from operations no authority publishes as one. Use parse_operations, which expands it. Or if a payload states no usable operation.

Example

>>> OperationRequest.parse("EPSG:15670").code
'15670'
>>> OperationRequest.parse("ITRF2014 to ETRF2014 (1)").name
'ITRF2014 to ETRF2014 (1)'
property urn: str | None

OGC URN for this operation, or None when the request is by name.

find_in(definition)[source]

Locate this operation within a PROJJSON operation tree.

Normalising axis order makes PROJ wrap the requested operation in a concatenated operation. That wrapper is often given the same identifier as the step it wraps, but PROJ also renames it, appending “(with axis order normalized for visualization)” to its name. Walking the tree in document order therefore meets the polluted wrapper name before the clean name on the step itself, so the last matching node is kept rather than the first: the wrapper can only repeat an identifier that a deeper, more specific node already carries.

A step that needs to touch only part of a compound target CRS (a vertical shift folded into a horizontal+vertical compound, for example) cannot be looked up as the registered operation as-is, so PROJ rebuilds it as an unidentified “PROJ-based operation method” and drops its id. Its name survives that rebuild – plain, or prefixed with “Inverse of” when applied in the reverse direction – so a request by code also falls back to matching by that code’s registered name.

Parameters:

definition (dict[str, Any]) – PROJJSON of the operation PROJ built.

Return type:

dict[str, Any] | None

Returns:

The matching operation node, or None if it is not present.

is_satisfied_by(definition)[source]

Whether a PROJJSON operation tree really contains this operation.

Parameters:

definition (dict[str, Any]) – PROJJSON of the operation PROJ built.

Return type:

bool

Returns:

True if the requested operation appears as the whole operation or as one of its steps.

__init__(text, auth_name, code, name, definition=None)