I am using the sf
package in R along with the arcpullr
package to pull in data from an ArcGIS REST service and work with it as an sf
object. I have run into an issue with a MULTIPOLYGON where sf
is only buffering a part of the MULTIPOLYGON (i.e., it buffers one polygon but only tiny slivers of the other). I have not been able to replicate the problem when buffering the example found here.
Here is an MRE (sorry, you'll have to install arcpullr if you don't have it).
# install.packages("arcpullr")
library(arcpullr)
library(sf) # redundant since loaded with arcpullr, but here for brevity
library(ggplot2)
tax_parcel_url <- paste0(
"https://mapservices.legis.wisconsin.gov/arcgis/rest/services/",
"WLIP/Parcels/FeatureServer/0"
)
parcel <-
get_spatial_layer(tax_parcel_url, where = "PARCELID = 'HA-11'") %>%
st_transform(crs = 3071)
parcel_buffer <- st_buffer(parcel, dist = 10)
# map of parcel
ggplot(data = parcel) + geom_sf() # this is correct
# map of parcel and buffer - buffer "misses" part of multipolygon
ggplot(data = parcel_buffer) +
geom_sf(color = "blue") +
geom_sf(data = parcel, color = "red", alpha = 0.3) +
theme_bw()