-
Notifications
You must be signed in to change notification settings - Fork 4
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
smoothr - apply to ARC #64
Labels
Comments
First stab library(silicate)
library(sf)
data(wrld_simpl, package = "maptools")
w <- st_as_sf(wrld_simpl)
#x <- polymesh
x <- subset(w, NAME %in% c("Brazil", "Paraguay", "Bolivia", "Peru", "Colombia")) #rmapshaper::ms_simplify(inlandwaters[c(3, 6), ])
a <- ARC(x)
b <- a$arc_link_vertex %>% split(.$arc_) %>%
purrr::map(~smoothr::smooth_chaikin(dplyr::inner_join(.x, a$vertex) %>%
dplyr::select(x_, y_) %>% as.matrix(), refinements = 3, wrap = FALSE))
# b <- a$arc_link_vertex %>% split(.$arc_) %>%
# purrr::map(~smoothr::smooth_spline(dplyr::inner_join(.x, a$vertex) %>%
# dplyr::select(x_, y_) %>% as.matrix(), n = nrow(.x) * 4, wrap = FALSE))
op <- par(mfrow = c(2, 1), mar = rep(0, 4))
plot(x$geometry, col = NA, border = NA, asp = "")
purrr::walk(b, lines, col = "red")
plot(x$geometry, asp = "")
par(op)
|
That is so cool! |
Try to implement Visvalingam https://bost.ocks.org/mike/simplify/ and https://gist.github.com/msbarry/9152218 |
Vis is done here: hypertidy/area#3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/mstrimas/smoothr
Apply this to arcs and recompose for topological-aware smoothing
The text was updated successfully, but these errors were encountered: