我在postgres DB中有一个名为“building_footprints”的表。
请参阅附图
并在查询表下面运行
SELECT row_to_json(fc) FROM (
SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (
SELECT 'Feature' As type, ST_AsGeoJSON(lg.the_geom)::json As geometry,
row_to_json((gid, the_geom)) As properties FROM building_footprints As lg
) As f) As fc
查询结果是:
我想将坐标value(coordinates":[[[[530500.00039933,545400.008863266],)
转换为lat / long。
答案 0 :(得分:0)
试试这个
SELECT id, the_geom , ST_X(the_geom::geometry), ST_Y(the_geom::geometry) FROM building_footprints;
你应该安装postgis扩展程序!