Search code examples
shapefileqgis

Extracting common polygons into a new shape file


I have two shape files from a survey conducted through different time-frames: file_1 (with 40 polygons) and file_2 (with 280 polygons). Each vector in these files are allotted a unique id and are mapped against a location name also. There are few polygon boundaries that are common to both files and I want to create a new shape file say file_3 which will have only those polygons that are common to both file_1 and file_2. Is there a way to achieve this in QGIS?


Solution

  • A few options depending on the quality of the data: If the location name field is unique, then you could use "Join attributes by field value", specifying the location field as the field to join, and discarding any that don't match.

    If the matching polygons in file_1 and file_2 are identical, then you could use "Join attribute by location" and then geometry predicate "equals" rather than intersect, again discarding those that don't match.

    If the polygons don't match exactly: this is where you might need to use your own judgement: If the polygons within each layer are widely spread you could use the "intersect" predicate in join by location instead. You could also use the "intersection" tool to determine overlaps between the two layers and join them based on that, but this may need some extra steps to clean the data.

    Some simpler options there, I'm sure someone will come by with a neater solution!