8

I would like to know what is the sense of using st_buffer operation. In PostGIS reference guide there is only the syntax and a short description of this operation.

Could you give some examples to understand the advantages of this operation?

3 Answers 3

13

As @Underdark comments ST_Dwithin is the recommended way of finding geometries at a distance. In many other gis-systems the buffer method is the only way but building buffers is quite costly.

But there is other use cases when you need to buffer. One reason can be to visualize a buffer. If you for instance wants to show the area closer than 100 meters from a highway, then you can make a buffer.

Another case is if you want to get the area 100 meters from the highway to be cut out from another map. Say you have a map showing areal usage and you want to analyze how much of the area closer than 100 meters from the highway is forest and how much is agriculture area. Then you make a buffer and creates an intersection with the area usage map.

There is an example on page 8-10 on this tutorial:
http://postgisonline.org/map.php?tutorial=mixed_examples.html

1
  • 1
    The last link appears to be dead.
    – Aaron
    Commented Jan 18, 2016 at 7:04
6

OpenGeo provides a pretty good summary of ST_Buffer. Note the ability to pass a negative buffer radius.

The buffer function is also a useful work around at times. By passing a buffer radius of zero, you can build a footprint of a collection of geometries or "repair" an invalid polygon geometry.

2

ummm to do a buffer? That's all it really does.

I wouldn't really call this a short description http://www.postgis.org/documentation/manual-svn/ST_Buffer.html

A use case is if you want to select all the objects in one table that are within 20m of each object in another table.

3
  • 4
    I think it's recommended to use ST_Distance for that use case.
    – underdark
    Commented Sep 18, 2011 at 10:48
  • 1
    No it's recommended to use ST_DWithin as Nicklas mentioned. ST_Distance is slow because it doesn't use an index. ST_DWithin uses an index and has short-circuit logic so it doesn't have to completely compute distance to figure out if 2 things are within the distance you specify. ST_Buffer should really only be used for visualization
    – Regina Obe
    Commented Sep 19, 2011 at 14:02
  • I read what I expected to read, not what was written :-) Commented Sep 21, 2011 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.