mapshaper icon indicating copy to clipboard operation
mapshaper copied to clipboard

Add -slice

Open simonepri opened this issue 6 years ago • 5 comments

Command description

Given a Polygon or MultiPolygon and a Line divide the polygon in 2 half (if the line passes through the polygon)

simonepri avatar Nov 28 '17 15:11 simonepri

As command it will be very nice but you can do that with the current available tools as well. Here is the workflow:

  1. Convert polygon to lines.
  2. Merge output of step1 and line together.
  3. Create polygons from the output of step2.

output of step3 will be the cut polygons.

geodata4all avatar Nov 28 '17 15:11 geodata4all

Thank you @meetirfan What about the properties of the Feature? If we convert it to a line we lose them. Anyway it would be nice to add as example to the reference.

simonepri avatar Nov 28 '17 16:11 simonepri

See also:

https://github.com/tilezen/vector-datasource/blob/master/data/tile-shapefile.py

On Tue, Nov 28, 2017 at 8:06 AM, Simone Primarosa [email protected] wrote:

What about the properties of the Feature? If we convert it to a line we lose them.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mbloch/mapshaper/issues/239#issuecomment-347572432, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0EO2VAQ3SraKE4_UtRBRfMJscShAKWks5s7C-FgaJpZM4QtZCj .

nvkelso avatar Nov 28 '17 16:11 nvkelso

yes you are right, in above workflow properties of the Features will be gone.

In my case I am using then QGIS to attached the properties by using spatial join.

geodata4all avatar Nov 28 '17 16:11 geodata4all

I approve of the polygon + polyline -slice proposal. I'd also like to add a polygon + polygon modality to -slice, which would slice two polygon layers into a mosaic of smaller polygons and assign properties from both layers to the output shapes.

mbloch avatar Feb 13 '18 15:02 mbloch