4

I want to produce a polygon layer out of lines like in this image with the command poligonize:

enter image description here Source: QGIS create boundaries from background image

The problem is that some of the lines are coming from polygons with the command polygon to line tool in QGIS like in this image:

enter image description here Source: How to merge overlapping and duplicate lines from vector layer to one single line?

I am struggling to understand which options I should use in v.clean to remove the overlapping segments of the line layer, or which other stepts or tools I could use to get the desired output in a straight way.

The main asumption is that lines match exactly.

My software QGIS 2.18 and GRASS 7.4

1
+50

I couldn't get v.clean to remove duplicates in the way I was expecting using rmdupl (or the -c option*). However, the QGIS algorithm "Delete duplicate geometries" works well. Steps:

  • Break lines at intersections with v.clean's "break"; enter image description here

  • Remove duplicates with "Delete duplicate geometries". enter image description here

  • Create the new polygons with "Polygonize" enter image description here

These could be chained with a single Processing model (click for gist of a model file).

Input polygon -> lines -> break -> remove duplicates -> polygon

*The 'recommended followup tools' in the dialog adds the -c option. From the help: Hint: Breaking lines should be followed by removing duplicates, e.g. v.clean ... tool=break,rmdupl. If the -c flag is used with v.clean ... tool=break, duplicates are automatically removed. Not working in this case for some reason.

  • "These could be chained with a single Processing model". That will be impressive! I have never been in the processing model yet, nice idea for the next question – Marco Jun 4 '18 at 7:52
  • I'm on QGIS 3.0 / Ubuntu 16.04 and the model builder dialog is not working but will add that when I get a chance. Thanks for screenshots, didn't have enough time to add workflow. – Simbamangu Jun 4 '18 at 8:46
  • However - I'd point out that 'Polygonize' was not your core question - I have not tested that last step and may remove it here. – Simbamangu Jun 4 '18 at 8:47
  • polygonize was the main goal (first line of my question) and I have tested it, that's why I marked as solved, because it works – Marco Jun 4 '18 at 9:09
  • I've added a link to a processing model - may not work in 2.18 but you can see the steps I've added in the image, should be reproducible. – Simbamangu Jun 6 '18 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.