如何从 PSQL jsonb_build_object 获取 GeoJSON 'Properties'?

How to get GeoJSON 'Properties' from PSQL jsonb_build_object?

我正在尝试从我的 OpenStreetMap 边界 postgis 服务器中获取真实的 GeoJSON [对你来说:psql -t -h {base64(MTg1LjIxOS4xMzIuMjE5)} -U boundaries -d boundaries]

构建 JSON 作品:

SELECTjsonb_build_object( 'type', 'Feature', 'id', gid, 'geometry', ST_AsGeoJSON(geom)::jsonb ) FROM al4 其中 ST_Intersects( ST_GeomFromText( 'Point(13.404954 52.520008)', 4326), al4.geom );

但我没能得到右括号中的 "row" 元素:

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;

提前致谢!

尝试

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;

此致