I am using PostgreSQL
, SQLAlchemy
and GeoAlchemy2
libraries to store some geospatial coordinates in the database.
I define the database column in my database as follows using Python:
import sqlalchemy as sa
import geoalchemy2 as ga
geo = sa.Column(ga.Geography('POINT', srid=4326)) # 4326 = WGS84 Lat Long
And I can add the geo coordinates by converting as follows:
self.geo = 'POINT({} {})'.format(latitude, longitude)
This encodes it as a string like: 0100002076ED....
My question is: How can I convert this string back to latitude, and longitude from within python?