[GIS] How to split polygons into line segments

grassqgisspatialite

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

Spain and Portugal

Best 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