bufferr-sfmultilinestring

Is the distance of ST_buffer function of Simple Features (SF) package calculated as total size or from geometry when linestring?


I have created a buffer zone around roads in a specific country. The spatial road dataset is of format Multilinestring.

I intended to create a buffer zone that is 1 km wide in total, so 5 km from the road on each side. Therefore I set the distance of ST_buffer to 1000 (as I'm using a metric projection). But now I'm wondering if the function means that 1000 m is the total distance of the buffer zone or just from the road (Multilinestring geometry) to one of the edges of the buffer? I can't find this specified anywhere, but if it is clarified somewhere else, I'd happily review that source. Any help is appreciated!

Code snippet used: buffer <- st_buffer(roads, dist=1000)


Solution

  • Buffer is defined as area within a certain distance (where the "certain distance" is a parameter).

    You will find it explained (including pictures) in the excellent Geocomputation book https://bookdown.org/robinlovelace/geocompr/geometric-operations.html#buffers - in fact better than I can in the space of this answer.

    In your specific use case: if you need the distance to be 1000 meters wide in total you need to set dist to 500 meters (because it will be 500 meters each side of your line).