I'm working with geospatial data and for one part of the analysis I need to use coordinate points of regions that I get from an excel and turn that data into sf object using st_as_sf
. When I tried to set a buffer around the points I use st_buffer(data_as_sf, 2000)
for a 2km buffer. This was working well with shapefiles where I had the geometry object as sfc_MULTIPOLYGON
. But now my geometry object is sfc_POINT
. How do I need to set the buffer in this case? Would it work well using regular st_buffer
method or do I need to convert it into sfc_MULTIPOLYGON
?
Asked
Active
Viewed 91 times
0

kiyis_stats
- 35
- 3
1 Answers
1
Why not simply test it out?
library(sf)
my_point <- st_sfc(st_point(c(0, 0)))
my_buffer <- st_buffer(my_point, 2000)
class(my_point)
#> [1] "sfc_POINT" "sfc"
class(my_buffer)
#> [1] "sfc_POLYGON" "sfc"
plot(my_buffer, axes = TRUE)
plot(my_point, add = TRUE)
We can see that st_buffer
has correctly created a 2,000m sfc_POLYGON
around our sfc_POINT
Created on 2023-02-23 with reprex v2.0.2

Allan Cameron
- 147,086
- 7
- 49
- 87
-
1Its not 2,000m unless you assign a coordinate system in metres. This is 2,000 unknown units... – Spacedman Feb 24 '23 at 11:47
-
@Spacedman yes, that's fair enough. I was guessing that the OP was working with a crs that was in metres, but I could be wrong about that. – Allan Cameron Feb 24 '23 at 13:10