7

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

Spain and Portugal

underdark
  • 84,148
  • 21
  • 231
  • 413
Kurt
  • 7,087
  • 4
  • 33
  • 51

2 Answers2

7

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.

Edit#3 In GRASS / only the tool v.to.lines is needed to do the job! enter image description here

Kurt
  • 7,087
  • 4
  • 33
  • 51
vinayan
  • 7,282
  • 3
  • 37
  • 75
  • @Kurt - could you run v.type.bl on your county borders and check the results? – vinayan Aug 25 '12 at 11:47
  • I importet my map of european countries in grass and run v.type.bl, but it does not work for me. It simply "converts" the polygons to lines, but doesnt generate the segments I need. eg. austria is now one line – Kurt Aug 25 '12 at 12:30
  • @Kurt - did you try v.type.bl followed by v.split? I think we have some understanding problem in defining what a segment is :) .. http://en.wikipedia.org/wiki/Line_segment – vinayan Aug 25 '12 at 12:36
  • 2
    tied it one more time , works now wel. thx for your kind support !! – Kurt Aug 25 '12 at 13:24
  • @Kurt - glad to know it worked :) – vinayan Aug 25 '12 at 13:27
  • Why in my Grass GIS on QGIS is don't have a v.type.bl and v.split, please show me how to add on my GRASS GIS – Damar Panoto Feb 06 '20 at 01:23
  • Can you show me how to processsing v.type.bl -> v.split on QGIS 3.10. because when i'm trying my result is failed – Damar Panoto Feb 06 '20 at 01:36
1

I understand that you want to turn your polygons into individual line segments, and that your concern is that segments d & f will not be created as separate lines?

  1. You'll use the built-in Vector | Geometry tools | Polygons to lines to split the polygons into two separate polylines, creating a new feature;
  2. Then you'll need the plugin 'Split Feature' to split the lines into individual segments - after install, select Plugins | Split Feature and select the feature created in step 1.

After running that procedure on two simple polygons, just as you show in your example, I ended up with 8 features, two of which are overlapping lines (corresponding to d & f); in the screenshot below, the 'id' refers to the original polygons, and each row is a separate line segment..

enter image description here

Simbamangu
  • 14,773
  • 6
  • 59
  • 93
  • 1
    your approach does the same in qgis what does the procedure vinayan suggested for grass. I end up with lots of segements with only 2 points. I will update my post with an picture to clarify – Kurt Aug 25 '12 at 12:39