I see libraries such as
shapely.geometry that support conversion to WKB and WKT binaries. What I am unable to find is guidance on converting to EWKB specifically.
I suspect this is because libraries that support WKB conversion also support EWKB? How do I know if I am creating an EWKB vs WKB? Are all WKB also EWKB (but not the other way around)?
If EWKB is an extension of WKB, how would I check that, say, Shapely, supports EWKB format?
I am trying to understand if EWKB is standard or something that was just built for PostGIS (where I have seen it used) and how I can make sure that data I am producing for a function that expects EWKB can be correctly formatted.
Because of @shongololo's comment, I wanted to add a snippet of what I am going presently to generate the WKB of the shape from GeoJSON.
from shapely.geometry import shape import binascii # convert geom to wkb format geom_str = json.dumps(route['geometry']) geom_geo = geojson.loads(geom_str) geom_shp = shape(geom_geo) geom_wkb = geom_shp.to_wkb() geom_cln = binascii.hexlify(geom_wkb).decode('ascii')