Can anyone help me how to convert to geojson the result of the query from ST_DWithin (objects within a certain radius)? im lost how to use ST_AsGeoJSON.
0
votes
1 Answers
0
votes
Use an aggregate function like ST_Collect to group the geometries:
SELECT ST_AsGeoJSON(ST_Collect(geocolumn))
FROM geotable
WHERE ST_DWithin(geocolumn, 'POINT(1000 1000)', 100.0);
The result will either be a MULTI- geometry, or GEOMETRYCOLLECTION.