A few days ago i provided an example Overpass query to show buildings with a mapped start_date colour coded by age. This was in response to a query by long-time Latvian contributor richlv. Another user based in Latvia asked on Mastodon if it was also possible to look at data by how long ago since it was edited.
This proved to be quite a lot harder than my previous example. The issue is that the “@timestamp” field in Overpass-Turbo is always treated as a string and is never cast to a number or date. This meant that the MapCSS queries have to deal with regular expressions, so I’ve just done the bands in years (“way[@timestamp=~/YYYY.*/]”), as I haven’t experimented with how rich the regexp implementation is for MapCSS. An example of the amended query for roads and buildings in a given bounding box is here.
If this seems vaguely familiar, ITO used to provide a tool, OSM Mapper, to visualise data by age (and many other parameters). Neither this, nor their later, more broadly-based, mapping tools ITO Map have really been replaced.
One, other thing, Keir Clarke at (Google) Maps Mania showed how to achieve the colour coding I mention in MapBox Studio (using data from Lviv). This slightly misses the point of doing the work in Overpass Turbo: it would have been much easier for me to do it, for instance, using QGIS, but that is no help to someone who wants a quick answer without using a toolchain (QGIS, MapBox Studio, TileMill, Kosmtik etc). The OSM ecosystem is still quite weak for users who want a relatively simple solution within a web browser.
Discussion
Comment from Colbertson on 14 December 2022 at 16:16
Awesome stuff
Comment from rtnf on 21 December 2022 at 02:01
Recently, I made a javascript frontend to color-code the OSM data by how long ago since it was edited. My approach is to automatically calculate the color based on the relative age gap between an object’s age and the oldest queried object .
But, currently, this frontend’s data is being supplied from OSM recent change API, not overpass API.
Comment from mmd on 27 December 2022 at 09:53
We also have an example on the Overpass by example wiki page highlighting the use of regular expressions to render objects according to some date: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Alternative_that_also_checks_the_syntax_of_the_collection_time