How to get lng lat value from query results of geoalchemy2

后端 未结 2 1688
日久生厌
日久生厌 2021-02-19 00:45

For exammple,

class Lake(Base):
     __tablename__ = \'lake\'
     id = Column(Integer, primary_key=True)
     name = Column(String)
     geom = Column(Geometry         


        
2条回答
  •  青春惊慌失措
    2021-02-19 01:08

    You can parse WKB (well-known binary) points, and even other geometry shapes, using shapely.

    from shapely import wkb
    for lake in query:
        point = wkb.loads(bytes(lake.point.data))
        print point.x, point.y
    

提交回复
热议问题