read_geometry¶
- geodetic_engine.geodesy.geometry.read_geometry(value, *, format=None, srid_authority='EPSG', axis_order='xy', crs=None)[source]¶
Read a geometry, and the CRS it states, from any encoding in
FORMATS.- Parameters:
value (
object) – WKT or EWKT text; WKB or EWKB as bytes or hex text in either case; a GeoJSON geometry object or Esri JSON geometry, as a mapping or JSON text; a Shapely geometry; or an object with a__geo_interface__. None reads as None.format (
Literal['wkt','wkb','wkb_hex','ewkt','ewkb','ewkb_hex','geojson','esrijson'] |None, default:None) – The encodingvalueis in, or None to tell fromvalue.srid_authority (
str, default:"EPSG") – The authority an SRID is a code of:"EPSG", or any other in the active proj.db, such as"ESRI".axis_order (
Literal['xy','crs'], default:"xy") –"xy"when the coordinates are longitude or easting first,"crs"when they are in the CRS’s declared order.crs (
object, default:None) – The CRSvalueis in, when it does not say. Needed foraxis_order="crs"then.
- Return type:
tuple[Geometry|None,CoordinateReferenceSystem|None]- Returns:
The geometry,
xy, and the CRS it is in – the one it states (an SRID, an EsrispatialReference), elsecrs, else None.- Raises:
TypeError – If
valueis none of the above.GeometryError – If it cannot be read, is curved, or states a CRS other than
crs.UnresolvableCRSError – If the CRS it states cannot be resolved.
ValueError – If
axis_order="crs"and no CRS is known.
Example
>>> geometry, crs = read_geometry( ... "0101000020E6100000C7726EBA353F24405B39F0746B7E4E40" ... ) >>> geometry.wkt, crs.authority_code ('POINT (10.123456789 60.987654321)', 'EPSG:4326')