5

I have a Multiline layer A with about 900 Features loaded (only a few of those are actually multi part geometries) in QGIS 2.14. I try to do Vector -> Geoprocessing Tools -> Difference with Layer A as the input vector layer and Layer A as the difference layer, expecting to get as a result an empty layer. But, the Output Shapefile has ~150 Features in it. Topology Checker says, there are no invalid geometries, but there are about 90 pseudo nodes in the layer. I started snooping around and found other line shapes that behave this way. Have I fundamentally misunderstood what a difference is, or is there some specific geometry problem that causes difference to behave oddly? The use case is silly, but I started with comparing an exported shape to its source, got weird results, and then tried to compare the source to itself as a sanity check. Now I feel I might have lost sanity. Help?

I get the same result in 2.8, so this is not a 2.14 bug.

3
  • Could you perhaps share your shapefile on a public server? I tested a multiline shapefile on QGIS 2.12.3-Lyon and I received an empty output.
    – Joseph
    Mar 11, 2016 at 13:45
  • We are working in EPSG 31466. These are legacy shapes produced in ArcView. But saving them as new shapes or in a different coordinate System doesnt Change the result. I also went through with the Topology Checker and removed all the pseudo nodes, so I dont get any geometry Errors anymore. But it didnt have an effect. Mar 11, 2016 at 13:59

1 Answer 1

2

Not exactly sure why this occurs when you use the Difference tool on the shapefile (perhaps multilines are not being processed correctly?) but to clean it up, I suggest using the GRASS function v.clean with the break tool which:

break lines at each intersection

v.clean

I left the threshold at 0.1 and only output the Cleaned layer. There are more line features now from the original 877 to 1263:

Cleaned layer

Now when running the Difference tool on the cleaned layer, on itself, the output is empty as you would expect:

Difference result

3
  • Hey Thanks! Although, that solution is going to cause some People some headaches. I wish there was a nice hearty topology error so that I would know that my results are nonsense. People doing a regular diff between data sets like this will not get real answers. Mar 11, 2016 at 15:13
  • @MonsterMushroom - Most welcome! There is the Geometry Checker plugin which you can download from Plugins > Download and Install Plugins which allows for both geometric and topographic error checking. This might be useful to use =)
    – Joseph
    Mar 11, 2016 at 15:23
  • 1
    Thats cool. Although it seems to not allow topology checks on lines or multilines. Mar 11, 2016 at 15:42

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.