mapshaper
mapshaper copied to clipboard
Add -slice
Command description
Given a Polygon or MultiPolygon and a Line divide the polygon in 2 half (if the line passes through the polygon)
As command it will be very nice but you can do that with the current available tools as well. Here is the workflow:
- Convert polygon to lines.
- Merge output of step1 and line together.
- Create polygons from the output of step2.
output of step3 will be the cut polygons.
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.
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 .
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.
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.