1

Is it possible in QGIS 3.16 to use the geoprocessing tool "Difference" with point layers as input and overlay?

The documentation seems to indicate that it is. However, when I do a test with very simple layers, it gives a GEOS geoprocessing error:

difference failed

The input layer has 10 points, and the overlay has 6 points - these 6 points are in the exact same location as 6 points in the input layer.

3

I get the same error. How to solve the problem:

  1. Apply a (small) buffer of the same size around both point layers.
  2. Run the Difference tool on these buffers.
  3. From the resulting buffers (the difference), get the centroids.

And here you are with the difference-points you want.

2
  • Nice solution! Thanks so much. Do you know if this is a bug in this version of QGIS or not?
    – Aquamarine
    Aug 20 at 21:36
  • I used QGIS 3.20, so the version does not matter. Probably its simply not made for point-geometries - however, it works with lines.
    – Babel
    Aug 20 at 22:05
0

An option to use difference function with point geometries is using QGIS expressions with Geometry generator or Geometry by expression (see here for details) with this expression:

difference (
    $geometry,
    aggregate('points_2', 'collect', $geometry
))

Expression used on layer points_1 (10 red dots) with difference from points_2 (6 blue triangles) results in 4 points (black rings) of points_1 that don't overlap points_2: enter image description here

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.