Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable max_cells in st_buffer #2488

Closed
olegzhelezn opened this issue Dec 11, 2024 · 3 comments
Closed

Variable max_cells in st_buffer #2488

olegzhelezn opened this issue Dec 11, 2024 · 3 comments

Comments

@olegzhelezn
Copy link

olegzhelezn commented Dec 11, 2024

I am buffering a series of polygons of different size using S2 (I have a large area so projecting them into one CS is not a good option). It provides correct estimates, however, the quality of the buffers is variable for large and small polygons. I suggest that the variable max_cells could be set up using a list of values (e.g. proportional to the perimeter of the polygon). Right now it is constant for all polygons.

image

@olegzhelezn olegzhelezn changed the title Variable max_cells in sf_buffer Variable max_cells in st_buffer Dec 11, 2024
@edzer
Copy link
Member

edzer commented Jan 7, 2025

That makes sense, and probably needs a modification in package s2.

@edzer
Copy link
Member

edzer commented Jan 7, 2025

library(sf)
# Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
demo(nc, echo = FALSE, ask = FALSE)
nc = nc[c(1,5,10),]
mc = c(10, 100, 10000)
b = st_buffer(nc, units::set_units(1e4, m), max_cells = mc)
plot(st_geometry(nc))
plot(st_geometry(b), add = TRUE)

gives:

x

@edzer edzer closed this as completed Jan 7, 2025
@olegzhelezn
Copy link
Author

Thanks a lot, it's a huge help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants