Colour-coding buildings by age in Overpass-Turbo
Posted by SK53 on 2 December 2022 in English. Last updated on 10 April 2024.The other day richlv asked on IRC if there was any OSM-based rendering showing the age of buildings. Although I could think of a couple of examples where people have done this, they did not use OSM data (other than the extremely early work.
![]()
I made use of open data of buildings from Portland Oregon to look at clustering, but the inspiration, and awareness that the data existed, came from a MapBox blog post.
A similar approach was taken by Waag who made use of the BAG open data on buildings for the whole of the The Netherlands.
I wondered if it was possible to use MapCSS styling within OverpassTurbo to create a simple way to achieve the same effect. After a bit of experimentation I was able to do this. I used Dutch localities as test areas as all buildings have been imported from BAG and therefore have start_date tags in a consistent format (“yyyy”). I also looked at other places with some buildings (usually those with a heritage protection) have start_date tags.
A couple of things I found:
- Tagged nodes (e.g., entrances) on a building outline got the default render. It was therefore necessary to have a MapCSS rule which makes all nodes have 100% transparency.
- Rules of the form [year<1925][year>=1950] didn’t seem to work as expected. Instead I relied on a single predicate and ordering the rendering rules so that the rule finding the oldest building is the topmost.
- I couldn’t find a way to both use the date() parsing function in Overpass and retain the original geometry. This is a shame because it should handle cases such as “c1860”, “1861-1862” and “1861-07-14” which a simple-minded approach does not.
All of these may just because I’m not familiar enough with these aspects.
Once I had some basic principles worked out, a big bonus was that the Waag Carto-CSS style sheet is available on Github, so I was able to copy both the precise colours they used and the date ranges. The resulting Overpass-Turbo query used to generate the map at the head of the post is here. Note that I used the Carto-DB dark tiles to provide a sufficiently dark background, and you need to be sufficiently zoomed in to see all buildings (if small POIs are not shown as points).
Just to show it working elsewhere, here is Central Manchester, with pretty much the same buildings mentioned in Frankie Roberto’s talk of 2009:
![]()
Discussion