This seems like it should be easy, but I'm not figuring it out: How do I convert a polygon layer into a line layer representing the polygon edges, where each edge belongs only to a single feature (or part)? When I convert from polygons to lines, each edge is represented twice (because each edge belongs to two adjacent polygons). Even if I dissolve the features, the duplicates remain as separate parts, so I cannot just dissolve, then split into singleparts. This causes problems with symbolization, for example if I want to use a dashed line style.
My thought was to split each polygon boundary into separate edge segments, as shown in these two questions:
Split polygon into lines
How do I split polygons into line segments?
…and then to remove duplicates, for example using v.clean with rmdupl. But I can't figure out how to do either of those steps.
For splitting segments, either the answer isn't in those two linked threads, or else I'm not understanding the explanation. Using v.split doesn't work, because I can only select to split by length, or by number of vertices, not by intersections with other line segments.
For removing duplicates, rmdupl isn't working; the duplicate edges always remain after I run the algorithm. It seems that the edges aren't recognized as duplicate geometries, even though they have identical points. (Running snap first didn't help; the layer appears to be topologically correct already.)
What am I missing?
Answer
If you are not forced to use QGIS, another Open Source GIS software OpenJUMP http://openjump.org/ has a Planer Graph tool that may be exactly what you need.
Here you can find the tool.
If you need only the edges you can uncheck all extra options.
The result contains the common edges only once. With real data the result may not be perfect because adjacent polygons do not necessarily share exactly the same vertices. In that case you must fix the source data or edit the planar graph layer.
If you want to create planar graph with just QGIS this answer may be useful QGIS Polygon edge style based on adjoining feature?.
No comments:
Post a Comment