added clean using Claudie Sonnet 4 Preview
Dear @ateucher
It has been such a pleasure using your package and I've used ms_simplify and more extensively. One command that I was missing dearly is clean. No other tool is so efficient at solving bad overlaps and gaps between features. I used Claude Sonnet 4 Preview as an agent in my VS Code to recreate an ms_clean function in the (hopefully) same way as the other commands in the repo are created.
A quick test has yielded great results (see before and after below). I hope the additions are according to your standards.
Kind regards Benja
Before:
After:
This was the code used to create the before and after:
test <- read_sf("https://storage.googleapis.com/assets-interactive/g/test/kurds.json")
# Clean the geometry
cleaned <- ms_clean(test)
ggplot(test) +
geom_sf(fill = "grey", alpha = 0.5, color = "black") +
coord_sf(xlim = c(42.971, 45.242), ylim = c(36.782, 38.628))
ggplot(cleaned) +
geom_sf(fill = "grey", alpha = 0.5, color = "black") +
coord_sf(xlim = c(42.971, 45.242), ylim = c(36.782, 38.628))
Hi @benjazehr, thank you for this! Very cool, and I appreciate you being upfront about the use of Claude to create this. I will have a look, but unfortunately not very soon - things are very busy right now.