TransformationResult¶
- class geodetic_engine.geodesy.TransformationResult[source]¶
Bases:
objectTransformed coordinates together with everything that produced them.
- coordinates¶
One tuple per point, holding that point’s values in
xyorder in the units of the target CRS’s axes. There is one value per axis the target CRS declares, so a vertical target yields one value per point even though PROJ computes three. If the input carried one value more than the source CRS declares – a height alongside a 2D horizontal CRS – that value is carried through unchanged as one extra trailing component, socoordinatescan then hold one more value per point thantarget_axeslists. Behaves as a plain tuple of tuples (indexing, iteration, equality), withCoordinates.to_list(),to_numpy()andto_dataframe()for exporting it in a specific format.
- source_crs¶
CRS the input was expressed in.
- target_crs¶
CRS the output is expressed in.
- operation¶
Which coordinate operation was applied, and how it was arrived at.
- grids¶
Grid files the operation depended on.
- coordinate_epoch¶
Decimal year supplied with the input, if any.
- coordinate_order¶
Order the values in
coordinatesare in. Always"xy": easting or longitude first wherever the target CRS has an easting and a northing to order, whatever order it declares them in. A CRS with no such pair – Krovak’s southing and westing, a geocentric X/Y/Z, a plant grid with a north and a west axis – is left in its declared order, exactly as PROJ’salways_xyleaves it;value_axis_orderontarget_crsstates the resulting order axis by axis. Present so that a caller readingtarget_axesas("Lat", "Lon")cannot mistake the declared axis order for the value order.
- pipeline¶
The whole chain as one PROJ pipeline definition, ready to be rebuilt with
pyproj.Transformer.from_pipeline(), or None when it cannot be written as a single pipeline. It reads the values the caller gave, in this package’sxyorder, and writes the values returned incoordinates, so replaying it reproduces the result – with one exception: at a vertical target it writes PROJ’s own three components, of whichcoordinateskeeps only the height.
- database_fingerprints¶
Paths and SHA-256 hashes of databases present when the transformation was resolved, retained across later calls.
Example
>>> from geodetic_engine.geodesy import transform >>> result = transform( ... "EPSG:4230", "EPSG:4326", (2.5, 63.5), operation="EPSG:1612" ... ) >>> result.target_axes ('Lat', 'Lon') >>> result.coordinate_order 'xy' >>> result.coordinates[0] (2.49818..., 63.49961...)
The axes are declared latitude first, the values are longitude first.
- property missing_grids: tuple[str, ...]¶
Names of grids the operation needs that are not installed.
Always empty on a returned result, since a missing grid raises. Kept so that a caller logging a result does not have to special-case it.
- to_json_dict()[source]¶
Render the result as plain data, for logging or serialisation.
Example
>>> from geodetic_engine.geodesy import transform >>> transform( ... "EPSG:4230", "EPSG:4326", (2.5, 63.5), operation="EPSG:1612" ... ).to_json_dict()["coordinates"] [[2.49818..., 63.49961...]]
- to_json(*, pretty=True)[source]¶
Serialise the result as JSON.
- Parameters:
pretty (
bool, default:True) – Whether to indent the output over several lines. True by default, since this is meant for a human to read; pass False for a compact form to log or send over the wire.- Return type:
- Returns:
The same fields as
to_json_dict(), as a JSON string.
Example
>>> print(result.to_json(pretty=False)) {"coordinates": [[10.7522, 59.9139]], ...}
- __init__(coordinates, source_crs, target_crs, operation, grids, coordinate_epoch, coordinate_order='xy', pipeline=None, database_fingerprints=())¶