[OSM-dev] Getting POI nodes deleted by user
Norbert Renner
ikonor at gmx.de
Wed Dec 13 20:49:54 UTC 2017
Here is an example using a regional full history extract from Geofabrik
[1] (covers changeset 53993885 area), Osmium Tool [2] and the OPL format
[3]:
wget http://download.geofabrik.de/europe/poland/wielkopolskie.osh.pbf
osmium cat wielkopolskie.osh.pbf -o wielkopolskie.osh.opl -t node
grep -B 1 --no-group-separator -E ' dD .* umrIimbsf '
wielkopolskie.osh.opl | \
grep -E '( T|,)(shop|amenity|office|tourism)' | \
osmium cat --no-progress -F opl -o deleted.osm.xml
Deleted nodes are bit tricky, because they don't have tags nor
coordinates. So what this does is:
- convert history file into OPL format (only the nodes)
- read from OPL file and filter all deleted objects by user (prefix
'u'), including the previous line to get the previous version that got
deleted (and has tags and coordinates). Assumes file is ordered by type,
object id and version
- then filter by the given tags (returns only the previous version, as
the deleting version has no tags)
- and convert the result into OSM XML format so it can be opened in JOSM
Edge cases are not handled here, like the mentioned undeletes or
redactions where only the delete version but no previous versions exist
(shouldn't matter in this case).
[1] http://download.geofabrik.de/europe/poland/wielkopolskie.html
[2] http://osmcode.org/osmium-tool/
[3] http://osmcode.org/opl-file-format/
More information about the dev
mailing list