I'm using my county's GIS data to update the roads in OpenStreetMap. I have a copy they published last year and one that was just published, and I'd like to find all the LineStrings that have either had their attributes or their geometry changed. This will assist me in making sure all the new and modified streets are updated in OpenStreetMap.

I'd like to do this using FOSS software, such as QGIS or Python/OGR. The street segments should have a unique identifier, so my only thought is to write a Python script which opens both Shapefiles, finds any segments in the new that aren't present in the old (added segments), and the reverse (removed segments), and then loop over matched pairs comparing their constituent coordinates to see if anything has changed.

Is this a good approach? Is there a simpler way?

  • 4
    It sounds like you are looking for a QGIS equivalent to ArcGIS Feature Compare – PolyGeo Oct 23 '12 at 23:38
  • +1 - really interesting question. I've had a look at comparing shapefiles in QGIS by selecting them in the attributes table, copying (ctrl-C/cmd-C) and pasting in a text editor to compare WKT text directly, but this doesn't do it segment by segment and is obviously tedious. Very interested to see a good solution come out of this question. For OSM data, you can download history for individual features, too, but it would be nice to have a generic solution. – Simbamangu Oct 26 '12 at 7:27

The thing you need to do is a temporal analysis. As you said you have two vector data(shp) of different times. you can find the change using geometry processing. In QGIS load two vectors and GoTo Vector->GeoProcessing and from there you can use Difference function which will give another shape as a result.

Hope that helps

| improve this answer | |
  • +1 - this works nicely for two OSM datasets a month apart, resulting in a layer that preserves the attributes of changed objects. – Simbamangu Nov 1 '12 at 16:21
  • 1
    but this would work only if the geometry was changes. what about attribute change? – sweet.sugar.cola Sep 28 '16 at 12:03

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 line. 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 line:

enter image description here

Modified line:

enter image description here

Changes happened:

enter image description here

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

| improve this answer | |

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.