3

As the attached screen shot I have one polygon layer (black) which has some missing polygons and another layer (red) which contains these polygons. Both were created from the same shapefile originally and they are multipoint polygons both CRS are set to WGS84

What I'm trying to do

Select polygons from complete layer (red) where gaps in target layer (black).

What I've tried

First selecting everything in the complete layer (red) then;

Using Vector / Research tools / Select by location. Select all the complete layer then remove from selection based on the overlap selection. This results in some but not all.

I then tried

Select all the complete layer then remove from selection based on the intersection selection. This results everything getting selected.

I was trying to find documentation on the precision function within the select by location to see if this might help. In my head overlap is the right function as i want to remove all the polygons that overlap one another which should leave just the mismatches which are my gaps.

EDIT; There's some useful reference on the Geometry predicate here ; Documentation "Join Attributes by Location" QGIS 2.18.

Have now additionally tried using the contains predicate but this also selects all as does within

Screen shot of problem

3 Answers 3

4

Another way is to use SAGA tool Polygon update through Processing Toolbox | SAGA | Vector polygon tools | Polygon update.

This tool takes two input layers, Layer A (your black) and Layer B (your red).
From complete Layer B, missing polygons are copied to Layer A.

Tested in QGIS 2.18.7 with SAGA 2.1.4. Please note latest QGIS and SAGA may not work well in the Processing Toolbox.

2
  • Wow, that is a nice tool. Runs very fast and saves me the next step of merge as well! Thank you Commented Jul 3, 2017 at 11:21
  • Thanks @mappingdom , btw please do not hesitate to accept your own answer. It helps future readers to find best solution.
    – Kazuhito
    Commented Jul 3, 2017 at 14:26
2

A postgis solution also exists for this question as explained here;

PostGIS: Select features that do NOT intersect

2

Firstly, you may try to select the features from the red layer that are equal to the black layer, and then invert the selection.

For doing this, use the Select by location algorithm with the following parameters:

  • Layer to select from: <your red layer>;
  • Additional layer (intersection layer): <your black layer>;
  • Geometric predicate: equals;
  • Precision: 0;
  • Modify current selection by: creating new selection.

Once you have done this, you can simply invert the selection from the Attribute Table.

At the same way, you can also preliminarily select all the features from the red layer and then setting removing from current selection option from the tool dialog.

2
  • Thank you so much, sometimes you overlook the obvious! Equal also worked using my original approach. It was just the Geometry predicate that was throwing it. Commented Jul 3, 2017 at 11:16
  • @mappingdom I know you were on the right path! However, I'm glad you found a working solution. :)
    – mgri
    Commented Jul 3, 2017 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.