I currently have a personal script that notifies me whenever an edit occurs in the vicinity of an open note (150 meter radius). I manually check the note and close it if the edit resolved it.
I’m wondering whether it could be turned into a useful bot. It’s kind of a workaround around the lack of note visibility.
To determine whether it’s useful as a bot, I’m considering manually collecting stats for a while. For each note found to be close to an edit, I’d manually mark whether this was a “hit” (the note is certainly relevant to the edit), a “miss” (the note is certainly irrelevant to the edit), or “unknown” (cannot tell without asking the mapper).
Any other suggestions for further empirical tests that would determine whether this script is useful as a bot? Anything similar done before?
The bot would write a message in the changeset, such as “It looks like you edited very close to the following note. Perhaps you can contribute to it or resolve it?”. Without any further measures, I estimate there would be about 3500 messages globally per day (this is the average of the last 7 days, sequences 4622-4628), but many measures can be taken to reduce this drastically, (lower radius, not notifying new users or users in certain editors, throttling messages per individual contributor, capping to x messages a day by prioritizing the edits nearest to notes, and so on)
Technical explanation: The script downloads the daily planet diffs and the full note file. It creates a rudimentary spatial index on the notes, then goes through the map changes one by one, calculating the distance from each feature to the nearest note. The script depends only on the python3 standard lib, and has no state except the sequence number of the last processed planet diff. It has a cache to avoid re-downloading things unnecessarily. Here is an example output, running it only for Israel.
Deleted /home/user/note-bot/data/notes/sorted_notes.csv. age is 60756 > 7200
Deleted /home/user/note-bot/data/notes/planet-notes-latest.osn.bz2. age is 61815 > 43200
Downloading https://planet.openstreetmap.org/notes/planet-notes-latest.osn.bz2...
Reading notes/planet-notes-latest.osn.bz2... (age: 0)
Filtering for open notes in [34.2654, 29.4534, 35.895, 33.277]
Processed 1 million notes
Processed 2 million notes
Processed 3 million notes
Processed 4 million notes
Started with 4636072 notes
4144108 were closed, leaving 491964
486492 were outside of bbox, leaving 5472 notes
Sorting remaining notes by longitude...
writing sorted notes to notes/sorted_notes.csv...
reading notes/sorted_notes.csv...
Reading diffs/last_processed.txt... (age: 56278)
Downloading https://planet.openstreetmap.org/replication/day/state.txt...
Reading diffs/cache/state.txt... (age: 0)
### Last processed state: (4627, '2025-05-14T00\\:00\\:00Z\n')
### Latest state: (4628, '2025-05-15T00\\:00\\:00Z\n')
######### Processing 4628
Downloading https://planet.openstreetmap.org/replication/day/000/004/628.osc.gz...
Reading diffs/cache/000/004/628.state.osc.gz... (age: 0)
Nodes processed: 3125625
Nodes outside bbox: 3123471
Nodes inside bbox: 2154
Nodes near notes: 223
Changesets near notes: 7
List:
https://www.openstreetmap.org/changeset/166272231
https://overpass-api.de/achavi/?changeset=166272231&relations=true
- https://www.openstreetmap.org/note/3052355
- https://www.openstreetmap.org/note/36634
- https://www.openstreetmap.org/note/2274822
https://www.openstreetmap.org/changeset/166237479
https://overpass-api.de/achavi/?changeset=166237479&relations=true
- https://www.openstreetmap.org/note/3731628
- https://www.openstreetmap.org/note/3731638
- https://www.openstreetmap.org/note/1298463
https://www.openstreetmap.org/changeset/166247042
https://overpass-api.de/achavi/?changeset=166247042&relations=true
- https://www.openstreetmap.org/note/588622
- https://www.openstreetmap.org/note/1274331
https://www.openstreetmap.org/changeset/166247045
https://overpass-api.de/achavi/?changeset=166247045&relations=true
- https://www.openstreetmap.org/note/588622
- https://www.openstreetmap.org/note/1274331
https://www.openstreetmap.org/changeset/166239434
https://overpass-api.de/achavi/?changeset=166239434&relations=true
- https://www.openstreetmap.org/note/4167031
https://www.openstreetmap.org/changeset/166253976
https://overpass-api.de/achavi/?changeset=166253976&relations=true
- https://www.openstreetmap.org/note/1573093
https://www.openstreetmap.org/changeset/166254411
https://overpass-api.de/achavi/?changeset=166254411&relations=true
- https://www.openstreetmap.org/note/3320498
- https://www.openstreetmap.org/note/3372835
Edit: there was an error in the daily estimation. Will update.