rmapshaper icon indicating copy to clipboard operation
rmapshaper copied to clipboard

added clean using Claudie Sonnet 4 Preview

Open benjazehr opened this issue 6 months ago • 2 comments

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: grafik

After: grafik

benjazehr avatar Jun 19 '25 17:06 benjazehr

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))

benjazehr avatar Jun 19 '25 17:06 benjazehr

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.

ateucher avatar Jun 24 '25 00:06 ateucher