我在Postgres中发现了有关Point类型的信息:http : //www.postgresql.org/docs/current/interactive/datatype-geometric.html
是否有此的SQLAlchemy版本?
我以这种方式存储值:(40.721959482,-73.878993913)
我发现这是对穆罕默德答案的轻微修改。
是的,我需要通过geo / sqlalchemy添加一个点列
from sqlalchemy import Column
from geoalchemy2 import Geometry
# and import others
class Shop(db.Model):
# other fields
coordinates = Column(Geometry('POINT'))
在我的PostGIS / Gres和PGloader方面,由于我是从将纬度和经度点格式设置为以下格式的csv加载的:"(40.721959482, -73.878993913)"
我需要在vim中为所有条目(有很多)做一个宏,以强制该列为了坚持在PostGIS中如何创建点,所以我将csv列变成point(40.721959482 -73.878993913)
,然后在创建表时将location列的数据类型设置为geometry(point)location geometry(point)
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句