collapse_concatenated

geodetic_engine.geodesy.utils.collapse_concatenated(operation, *, tolerance_m=1e-3, samples=512)[source]

Rewrite a concatenated Helmert chain as one equivalent Helmert.

The composed parameters are verified against PROJ’s own rendering of the original chain over the operation’s area of use. A collapse that does not reproduce the chain is refused rather than returned, because the whole point of collapsing is to keep the transformation the authority defined.

Parameters:
  • operation (CoordinateOperation) – A concatenated operation whose steps are all plain Helmerts.

  • tolerance_m (float, default: 1e-3) – Largest residual, in metres, that may remain between the collapsed operation and the original chain. Defaults to 1 mm, which is far below the accuracy of any published datum shift while still catching a genuine convention or unit error.

  • samples (int, default: 512) – How many points to compare across the area of use.

Return type:

CoordinateOperation

Returns:

A single step coordinate operation between the same CRSs, stating the composed parameters in the position vector convention.

Raises:

NotCollapsibleError – If a step is not a Helmert, if the steps mix domains, if the source or target CRS cannot be read, or if the composed parameters do not reproduce the chain within tolerance_m.

Example

>>> chain = CoordinateOperation.from_authority("EPSG", 8047)
>>> collapsed = collapse_concatenated(chain)
>>> round(collapsed.towgs84[0], 3)
-84.491