I have a geoalchemy2.elements.WKBElement
that comes from a query on a Postgres/PostGIS view. I want to convert this to WKT, or otherwise encode it so that it is (Geo)JSON serialisable. How can I accomplish this?
Assuming similarity to shapely, I thought that geoalchemy2.elements.WKBElement
would have a wkt
property or class method, but it does not. The __str__
method returns the binascii.hexlify
representation of the WKB. In the source for the geoalchemy2.elements
there appears to be little else to use.
I'm about to build GDAL with python bindings to attempt to read the WKB and then output as WKT, but this feels like more work than I expected.