0

After installing a fresh QGIS 3.10 version on a Windows computer I recently saw an unexpected behavior of the "Difference" feature from QGIS. (on one of my old computer with QGIS 3.4 it is different) I'm trying to remove points from a layer that falls into a polygon from another layer. After running the "Difference" model the points that falls into the polygon layer are moved to the x,y position x=0 and y=0. Has anyone an idea why this happens. My expected output is simple a layer without the points that falls into the polygon. I want to use the "difference" function because it should be integrated in a bigger model.

Process:

three points

poly that covers two points

tree points

function

result

Freddy
  • 21
  • 3
  • Select by location instead? – GISHuman Apr 22 '20 at 21:29
  • https://gis.stackexchange.com/q/61753/62556 – Konan Pruiksma Apr 22 '20 at 23:17
  • Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Please check out our short [tour] to learn about our focussed Q&A format. Please don't include thanks (or other chit chat) in questions you ask here. The way to say thanks here is to upvote (or accept) answers to your questions). – PolyGeo Apr 22 '20 at 23:42
  • @GISKid, select by location with the model "Extract by location" and the option "disjoint" solves the problem. – Freddy Apr 23 '20 at 07:28

2 Answers2

2

I can't reproduce your particular error, but when I try a similar function in QGIS 3.12.2 with simple shapefile point and polygon data (geometry valid per GEOS), I keep getting GEOS geoprocessing error: difference failed. - after a varying length of time depending on the size of the data.

However I have been able to make it run properly with the exact same point and polygon data in QGIS 3.10.5 (English version if that makes a difference)

Both versions are running GDAL version: 3.0.4, GEOS version: 3.8.1-CAPI-1.13.3, PROJ version: Rel. 6.3.1. No issues with lines/polygons or polygons/polygons or lines/lines in either version.

I think it's a legitimate issue that Difference is not working as expected.


However as @GISKid suggested, to solve your specific problem, consider using Select by Location - if you wish to use this in a processing model try Extract by Location and use the disjoint spatial predicate (not sure what these are called in German) to return a dataset that you can feed into the next step.

she_weeds
  • 12,488
  • 1
  • 28
  • 58
  • select by location with the model "Extract by location" and the option "disjoint" solves the problem. – Freddy Apr 23 '20 at 07:29
  • I have also tested the behavior described above with different configuration. For example with (QGIS 3.6.1 & GDAL 2.4.1) the difference function is working fine for the point layer. When using (QGIS 3.10.5 & GDAL 3.0.4) the behavior is exactly like I'm described above. I'm not sure if the GDAL version is effecting the function because the "Difference" function is a build in function from QGIS and is not using the GDAL Library. – Freddy Apr 23 '20 at 07:38
  • The behavior was reported several times in the last years: link and link – Freddy Apr 23 '20 at 07:40
0

The "GEOS geoprocessing error: difference failed" issue with the "Difference" processing algorithm is now fixed in the developer version QGIS 3.27.0-Master starting from the 5a6b76a commit, and will be fixed in the stable versions starting from QGIS 3.26.1 and from QGIS LTR 3.22.10.

See https://github.com/qgis/QGIS/pull/49300.

Andrea Giudiceandrea
  • 1,319
  • 10
  • 17