Geographic Information Systems Asked by Pman on September 30, 2020
I have two shapefiles that are the same in terms of the type of information they contain (same attribute fields). One is essentially an updated version of the other, so the newer version contains all the data of the earlier version plus more.
Each data entry has a unique id field. I am looking for a way to essentially ‘subtract’ the older shapefile from the newer one. This cannot be a spatial operation, it must be based on the attributes. I use primarily OGR and QGIS.
Any ideas on how to do something like this?
Maybe Layers by Field QGIS Plugin could do what you need
Answered by rnuryadin on September 30, 2020
I assume a situation like below:
school_layer_1
)school_layer_2
)And we want to know which schools are newly built.
Then we can use a Virtual Layer to find out suspicious schools.
The SQL query is:
SELECT * FROM school_layer_2
WHERE id
IN (
SELECT id FROM school_layer_2
EXCEPT
SELECT id FROM school_layer_1
)
The produced Virtual Layer (green circles) is a point layer with the records of difference between school_layer_1
and school_layer_2
.
Answered by Kazuhito on September 30, 2020
There is a new tool which was added in QGIS 3.12 called "Detect dataset changes" that does exactly what you want. It accepts any geometry type including point. The tool
Compares two vector layers, and determines which features are unchanged, added or deleted between the two. It is designed for comparing two different versions of the same dataset.
Original point:
Modified point:
Changes happened:
Please refer to the help above for more detailed information.
Information in the changelog for QGIS 3.12: https://qgis.org/en/site/forusers/visualchangelog312/#feature-add-new-algorithm-detect-dataset-changes
Answered by ahmadhanb on September 30, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP