I have a polygon which I want to split using overlapping polygons in order to create 3 polygons (with the original attributes) How can i achieve it using R ?

enter image description here

enter image description here

enter image description here

  • 1
    probably sf::st_intersection
    – mdsumner
    May 6, 2020 at 3:28
  • I've tried st_intersection but it doesn't divide the polygon. Instead it generates the same geometry everytime it overlaps the other polygons (in this case I ended up with 5 polygons)
    – Sofia R
    May 6, 2020 at 20:47
  • 3
    Can you put together a reprex, I think your q is fair but it's hard to do this stuff without an example. Any chance you can subset out the relevant rows, save as rds or write to gpkg and share?
    – mdsumner
    May 6, 2020 at 21:50

1 Answer 1


For sure you just need to do an st_intersection like:

st_intersection(pol1, pol2)

If you get a 5 features polygon is because your pol1 is overlaping five "colored" polygons. If you are looking for 3 polygon result, you should just dissolve blue/green polygons and yellow/pinky ones bufore. You can do it by assign them a unique ID, group_by that ID and summarize them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.