我在postgres数据库里有geom。当我使用此查询时

SELECT   ST_AsGeoJSON(st_simplify(geom,0.01))::json  As geometry FROM tbl_tehsils

结果显示
"{"type":"MultiPolygon","coordinates":[[[[72.3847874560001,33.4222288170001],[72.4486151570001,33.390380325], (...)"

而我喜欢创造结果
[[31.7143740770001,74.6556250200001],[31.256258297,74.244557296]]

我在用postgres(postgis)。

最佳答案

你可以这样提取坐标。

select ST_AsGeoJSON(st_simplify(geom,0.01))::json->>'coordinates' from tbl_tehsils ;

关于json - Geom到简单的json,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47420060/

10-13 03:24