I have several shapefiles which contain buildings built in different periods from 1948 to 2013. My question is how could I see which buildings for example in were built 1948 but are missing in later periods? Is there a tool in QGIS, or something for automatization? I would think clicking and unclicking layers wouldn't be the best and most efficient option.


Data: shapefiles, aerial imagery (1948, 1971, 1981, 2009, 2013)

I use one shapefile that has a field with the dates of when the buildings were built, such as: before 1948, 1970, between 1971-1981, 1981-2009, built after 2009. They all share the same number of fields and data, the things which differs are the attributes of course. But I'm not sure about this option.

Initially, I was thinking of separating the into 5 shapefiles so as to figure out an easier way to see the differences. As an example: shp 1948 contains (buildings built until 1948), 1971 (all until 1971 including data of previous shp), so on and so forth.

The thing is I used aerial imagery from those years to see whether those buildings still exist or not, so as to update each shapefile correspondingly. Partially done while the data was under a single shapefile, as some were missing.

  • You could probably use the tool referenced in this question: gis.stackexchange.com/questions/62949/… – Branco Jun 8 '15 at 16:00
  • 1
    Please describe your input data in more detail. Do you have one Shapefile per year? Are there any attributes to reidentify the same building in different Shapefiles? Is the geometry of a building consistent throughout different Shapefiles? Screenshots could help as well. – underdark Jun 8 '15 at 17:16
  • Ok, the input data is one shapefile for each of the following years: 1948, 1971, 1981, 2009, and 2013. Apparently, the geometry indeed is at places a bit loose, in some instances it overlaps (need to quickly solve that part out). When I first used the Difference for example, as output I got some wierd shaped polygons. – Geosphere Jun 8 '15 at 19:39
  • @Branco, that's a good suggestion, I already knew of Difference but I'm not sure if that's one, already tried it. – Geosphere Jun 8 '15 at 19:40
  • 2
    You should edit your question, using the button at the lower left, to provide additional detail. The key thing here is going to be an unaddressed part of underdark's comment - is there an attribute that identifies buildings in the data, consistent from year to year? If not, you will have no way of knowing if a building was replaced or modified between years, just if it completely went away at any point (and that's assuming your data is valid for every year and not just missing features or bad/mislocated mapping). More info about what you're trying to do with the info might suggest methods. – Chris W Jun 8 '15 at 20:39

I'd give PostGIS a try. E.g., if you have two tables b48 and b71 with buildings from 1948 and 1971 respectively (with fields "gid" as building identifier and "geom" as the building geometry), you could easily find the differences with something like:

SELECT b48.gid gid48,b71.gid gid71,ST_Area(ST_Intersection(b48.geom,b71.geom))/ST_Area(b71.geom) ratio
FROM b48 RIGHT JOIN b71 ON ST_DWithin(b48.geom,b71.geom,5)
WHERE b48.gid IS NULL OR ST_Area(ST_Intersection(b48.geom,b71.geom))/ST_Area(b71.geom)<>1;

This would produce a list of identifiers of buildings from 1948 that were changed by 1971 (having area ratio not equal to one) and all the new buildings, built after 1948.

SELECT b48.gid gid48 FROM b48 LEFT JOIN b71 ON ST_DWithin(b48.geom,b71.geom,5) WHERE b71.gid IS NULL;

would produce a list of buildings that were built in 1948 but were not there in 1971.

PostGIS gives you plenty of options for comparing similar, but not perfectly matching geometries. My comparison of buildings 5 m apart is OK for not too dense area. Comparison of intersection ratios would be better for dense housing like terrace houses where boundaries between houses might vary in your data.

| improve this answer | |
  • Actually, you managed to understand my needs. From the looks of it, you're solution is what I'm looking for, although I was hoping for a QGIS, maybe GRASS solution but this is not bad at all. My buildings are located in small commune in a French mountainous region so there is not a high density nor are they very dispersed either. – Geosphere Jun 9 '15 at 7:35
  • The first query you've given me works but I can't figure out how well since I'm having problems loading the results as a new layer. The second one doesn't work, no error, it just shows me one field name and nothing else. – Geosphere Jun 9 '15 at 14:02
  • I managed to get a table out of the first one but I can't really do much with it. Nor can I join it properly with another shapefile. Am I missing something here? – Geosphere Jun 9 '15 at 14:55
  • I like to create views in PostGIS and then open them in QGIS as regular spatial tables.So the results for the second example would be produced like: CREATE VIEW changed48 AS SELECT b48.gid,b48.geom FROM b48 LEFT JOIN b71 ON ST_DWithin(b48.geom,b71.geom,5) WHERE b71.gid IS NULL; This view can be opened in QGIS like any other table, if you list other fields in the "SELECT" statement, you'll have them in the table. – Robert Špendl Jun 11 '15 at 5:17

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.