How to get lng lat value from query results of geoalchemy2
        Posted  
        
            by 
                user2213606
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user2213606
        
        
        
        Published on 2014-06-07T01:34:13Z
        Indexed on 
            2014/06/07
            9:25 UTC
        
        
        Read the original article
        Hit count: 399
        
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
© Stack Overflow or respective owner