我正在尝试从我的OpenStreetMap边界Postgis服务器中获取真实的GeoJSON [为您:psql -t -h {base64(MTg1LjIxOS4xMzIuMjE5)} -U boundaries -d boundaries
]
构建JSON的工作原理:
选择jsonb_build_object( '类型','功能', 'id',gid, 'geometry',ST_AsGeoJSON(geom):: jsonb )FROM al4,其中ST_Intersects(ST_GeomFromText('Point(13.404954 52.520008)',4326),al4.geom);
但我无法在右括号中获得“行”元素:
SELECT jsonb_build_object(
'type', 'Feature',
'id', gid,
'geometry', ST_AsGeoJSON(geom)::jsonb,
'properties', to_jsonb(row) - 'gid' - 'geom'
) FROM (al4 where ST_Intersects( ST_GeomFromText( 'Point(13.404954 52.520008)', 4326 ), al4.geom )) row;
谢谢!
答案 0 :(得分:0)
尝试
SELECT jsonb_build_object(
'type', 'Feature',
'id', gid,
'geometry', ST_AsGeoJSON(geom)::jsonb,
'properties', to_jsonb(row) - 'gid' - 'geom'
) FROM
(SELECT * FROM al4
where ST_Intersects( ST_GeomFromText( 'Point(13.404954 52.520008)', 4326 ), al4.geom )
) row;
致谢