![](/img/trans.png)
[英]I can see node-express server response but i cannot use it in my angular2 promise service
[英]How can I store Geojson response into Postgres Database using node-express?
注意: Geojson响应包含坐标数据类型,需要将其作为几何数据类型存储在Postgres中。
我不想使用任何第三方软件(例如Qgis或ArcGIS)或命令行工具(例如Postgis中的geojson2psql)。
使用jsonb列。
使用->
运算符查询jsonb列中的特定属性很简单。 例如,假设列名称为“ geodata”,则此查询:
SELECT geodata->'geometry'->'coordinates' AS coords FROM geo_example;
...将从我从Leaflet抓取的这个GeoJSON示例返回[-104.99404,39.75621] :
{
"type": "Feature",
"properties": {
"name": "Coors Field",
"amenity": "Baseball Stadium",
"popupContent": "This is where the Rockies play!"
},
"geometry": {
"type": "Point",
"coordinates": [-104.99404, 39.75621]
}
};
这是一个SQL Fiddle,显示了几个示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.