kiyis_stats
kiyis_stats

Reputation: 35

st_buffer with geometry sfc_POINT

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?

Upvotes: 0

Views: 242

Answers (1)

Allan Cameron
Allan Cameron

Reputation: 173793

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

Upvotes: 1

Related Questions