mbloch/mapshaper

Is there a way to use a polygon as it was a blade?

Closed this issue · 3 comments

Hi,
I have input.shp polygon file. I would like to use blade.shp to split the first, at the polygon boundaries of the second.

How to do it in mapshaper cli?

Thank you

mbloch commented

Hi!

There's no direct way to do this right now. You could do it in several steps using the -union command, which takes two polygon layers and creates an output layer containing polygons that have been split along overlapping boundaries. You could then delete the polygon parts that belonged only to your "blade" layer by filtering on an attribute field. If you start experimenting, I'm sure you'll see how to do it.

I guess you could also do a "clip" and an "erase", and then merge the two output layers.

The functionality you want could be added to the -divide command, which currently only uses polygons to slice up lines. .. I'll have to think about how useful that would be.

Hi!!!

You could do it in several steps using the -union command

When I run

mapshaper -i unione_dissolved.shp -i mari.shp -union -o tmp.shp

I have Error: Command requires at least two target layers. What is the stupid mistake i make?

Thank you

Solved, thank you. In the next days I will write a small how-to.

Thank you again