I have points that form a line. I would like to assign a radius to each point to give them volume, e.g. 50m and then find the area of the combined points. Does anyone know of a way to do this in PostGIS?
2 Answers
I guess you mean the area of the combined 50m buffers?
If so, then like this:
SELECT SUM(ST_Area(ST_Buffer(geom, 50))) FROM points;
This assumes that the points are projected in a CRS with meters as units. And I'm not sure I understand what you mean by "points that form a line". Is the PostGIS table a point feature or line feature?
-
The points are coordinates from a person walking across a field. So they are points but represent the path that the person walked. Commented Apr 7, 2015 at 19:39
-
Then the above should work, provided the coordinate reference system uses a meter units, NOT longitude/latitude– MichaCommented Apr 7, 2015 at 19:41
-
1The area of buffer of every point will be the same so there's no need to call those functions for every point. Commented Apr 8, 2015 at 13:08
-
Unless some points are closer than 50 meters and the circles overlap...– MichaCommented Apr 8, 2015 at 15:28
-
@Micha In which case the result will be the same as the query doesn't aggregate the buffers. Commented Apr 9, 2015 at 16:54
If the area of the buffers should be combined (as not to count the same area several times) then this query should be used:
SELECT ST_Area(ST_Union(ST_Buffer(geom, 50))) FROM points;