geodetic_engine.geodesy.geometry¶
Read, write, round and transform vector geometries.
Geometries are read from, and written to, the encodings databases, GDAL and
web services exchange: WKT, WKB and hex WKB in their ISO flavour, PostGIS
EWKT and EWKB with an SRID, GeoJSON geometry objects, Esri JSON geometries,
and Shapely geometries or anything with a __geo_interface__.
transform_geometry() and
transform_geometries() transform
them with the guarantees points have, since every coordinate goes through
transform_arrays().
“WKT” here is geometry WKT (OGC Simple Features), such as POINT (10 60),
not the CRS WKT
from_user_input() reads.
Coordinates are xy, longitude or easting first, as WKT and WKB are in
practice. axis_order="crs" reads and writes a CRS’s declared order
instead, for data written latitude first. An SRID is a bare integer, so
srid_authority says which authority it is a code of; SRID 0 is unknown.
Rounding works on the coordinate values, not in the writer, so every
encoding holds the same numbers: decimals rounds half up by each value’s
shortest decimal form, and grid_size snaps to a grid keeping polygons
valid.
Shapely refuses curved geometries, and so does this module. M values are read, carried through a transformation unchanged and written, except to GeoJSON, which has no place for them.
Example
>>> from geodetic_engine.geodesy import Transformation
>>> tfm = Transformation("EPSG:4230", "EPSG:32631", operation="EPSG:1612")
>>> result = tfm.transform_geometry("SRID=4230;POINT (2.5 63.5)")
>>> result.wkt(decimals=2)
'POINT (475017.58 7041354.6)'
>>> result.ewkt(decimals=2)
'SRID=32631;POINT (475017.58 7041354.6)'
Functions¶
Classes¶
A transformed geometry, its provenance, and its encodings. |
|
Transformed geometries, their provenance, and their encodings. |
Constants and type aliases¶
The encodings |
Re-exported¶
Importable from here for convenience; documented where they are defined.