Saturday 8 July 2017

qgis - How do I split polygons into line segments?


How can I split my polygon file into "segements"? The lines should be broken up like this picture shows:


Spain and Portugal



Answer



In Grass, v.type.bl can be used to convert polygons to lines. You can follow it up by v.split to convert to line segments. The screens are from Qgis. Set max number of vertices to 2 in v.split as shown below.



enter image description here


Edit: The above method will not give you duplicates at d and f. If duplicate segments are required, you could probably replace the first step(v.type.bl) with the Qgis Polygons to Lines tool(Vector -> Geometry tools -> Polygons to Lines).


Edit#2 - "Any number of Points in a segment" seems a little confusing. You can specify the maximun segment length, or maximum number of vertices to refine your needs in v.split. But my gut feeling says that you only need v.type.bl. See the output of only v.type.bl below. It gives 6 segments for the three counties from California.


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...