1

Short explanation of my problem:

enter image description here

On the picture two polygons are shown. The highlighted (yellow) polygon is above the green polygon. Now, two operations are performed.

yellowFeature.geometry().overlaps(greenFeature.geometry()) --> False
greenFeature.geometry().contains(yellowFeature.geometry()) --> True

The results of the two functions were to be expected. Now the yellow geometry is divided into two halves.

enter image description here

Again, the two operations are performed.

yellowFeature.geometry().overlaps(greenFeature.geometry()) --> True
greenFeature.geometry().contains(yellowFeature.geometry()) --> False

The result I did not expect. I expected the same results as before the cut operation. This behavior results in another program to a major problem, since the geometry is correct and the yellow geometry does not overlap.

How can I change this behavior? Does it have anything to do with the precision (decimal)?

My settings: Topological editing is enabled. Snapping tolerance 5px.

  • In your 2nd image where that second split has occurred, check that the top geometry also has a node in the middle. It could be there that the overlap is happening. – Knightshound May 31 '16 at 8:19
  • In my experience topological editing and editing in general is working with lots of geometrical errors and misplaced nodes. It is not the most reliable feature Qgis has. What is the topology checking tool (under menue Vector) saying? – Matte May 31 '16 at 9:25
1

By Cut-operation, a new node is created. This leads to a minimal overlap of the two geometries. In this point QGIS is right and there is no incorrect behavior.

In my case, I need to know whether an overlap exists. As a minimum overlap can be ignored, I will calculate the area of the overlapping area.

Based on the above case:

yellowFeature.geometry().difference(greenFeature.geometry()).area()

In short: QGIS is right and I use the workaround for my special case

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.