![](/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.