考虑以下带有几何字段的SQLAalchemy
/ ORM:GeoAlchemy2
from geoalchemy2 import Geometry, WKTElement
class Item(Base):
__tablename__ = 'item'
id = Column(Integer, primary_key=True)
...
geom = Column(Geometry(geometry_type='POINTZ', srid=4326))
当我在 PostgreSQL shell 中更新一个项目时:
UPDATE item SET geom = st_geomFromText('POINT(2 3 0)', 4326) WHERE id = 5;
获取字段:
items = session.query(Item).\
filter(Item.id == 3)
for item in items:
print item.geom
给出:
01e9030000000000000000004000000000000008400000000000000000
这不是一个正确的 WKB - 至少,它不能用Shapely 的loads
.
我如何获得该字段的lat
/ ?lon
geom