How to get lng lat value from query results of geoalchemy2
- by user2213606
For exammple,
class Lake(Base):
__tablename__ = 'lake'
id = Column(Integer, primary_key=True)
name = Column(String)
geom = Column(Geometry('POLYGON'))
point = Column(Geometry('Point'))
lake = Lake(name='Orta', geom='POLYGON((3 0,6 0,6 3,3 3,3 0))', point="POINT(2 9)")
query = session.query(Lake).filter(Lake.geom.ST_Contains('POINT(4 1)'))
for lake in query:
print lake.point
it returned <WKBElement at 0x2720ed0; '010100000000000000000000400000000000002240'>
I also tried to do lake.point.ST_X() but it didn't give the expected latitude neither
What is the correct way to transform the value from WKBElement to readable and useful format, say (lng, lat)?
Thanks