Bookmarklet helpers for resolving OSM Notes

I made 2 bookmarklets that you could find useful.

  1. View OSM data snapshot at the time of note creation (or in case of maps.me / Organic Maps - downloaded map file timestamp). This is useful for old notes where you suspect the issue has been already addressed, but you need context to close the Note.
javascript:(function(){var id=location.href.match(/www\.openstreetmap\.org\/note\/(\d+)/);if(id!=null){var req=new XMLHttpRequest;req.open("GET","https://www.openstreetmap.org/api/0.6/notes/"+id[1]+".json",false);req.send(null);var note=JSON.parse(req.responseText);var date=new Date(note.properties.date_created.replace(" UTC",""));var lat=note.geometry.coordinates[1];var lon=note.geometry.coordinates[0];var zoom=18;var isoDate=date.toISOString();var noteText=note.properties.comments[0].text;var osmDataVersion=noteText.match(/OSM data version\: ([\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}\:[\d]{2}\:[\d]{2}\Z)/);if(osmDataVersion!=null){isoDate=osmDataVersion[1]}var queryString='[date:"'+isoDate+'"];\n(\n  node({{bbox}});\n  way({{bbox}});\n  //relation({{bbox}});\n);\r\nout meta;\n>;\nout meta qt;';window.open("https://overpass-turbo.eu/?Q="+escape(queryString)+"&C="+lat+";"+lon+";"+zoom+"&R")}else{alert("This is not a valid OSM note page.")}})();
  1. Translate a note (you can change en to another language code which Google Translate understands).
javascript:(function(){var id=location.href.match(/www\.openstreetmap\.org\/note\/(\d+)/);if(id!=null){var req=new XMLHttpRequest;req.open("GET", "https://www.openstreetmap.org/api/0.6/notes/"+id[1]+".json",false);req.send(null);var note=JSON.parse(req.responseText);var noteText=note.properties.comments[0].text;window.open("https://translate.google.com/?sl=auto&tl=en&op=translate&text="+encodeURI(noteText))}else{alert("This is not a valid OSM note page.")}})();

How to use: Open bookmarks menu in your browser and paste above text as URL, save. Navigate to a note page https://openstreetmap.org/note/... and open the bookmarkpet

6 Likes