2
SELECT ST_Buffer(geom, 400)
FROM my_table;

This query creates a buffer in 400 degrees. How can I change it to have 400m buffers around points? I have tried to use ST_Transform and ST_SetSRID but I got errors. Most likely because I structure my query wrong. Thank you for your help.

markus
  • 81
  • 7

1 Answers1

2

ST_buffer uses the projection unit. You can cast the geometry to a geography to use meters, or rely on a suitable local projection whose unit is in meters.

SELECT ST_Buffer(geom::geography, 400)
FROM my_table;

If it is not yet set, you may have to set the original CRS first

SELECT ST_Buffer(st_setSRID(geom,4326)::geography, 400)
FROM my_table;
JGH
  • 15,928
  • 4
  • 31
  • 48