PostGIS空间表查询GeoJSON
查看代码
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(geom)::json as geometry
, (
SELECT
row_to_json(t)
FROM (
SELECT
id, user,content
) AS t
) AS properties
FROM test_table
) AS f
) AS fc

浙公网安备 33010602011771号