Bookmarklets helpers for solving OSM Notes

I made 2 bookmarklets that you could find useful.

  1. Open overpass turbo with OSM data snapshot at the time of note creation (or in case of maps.me / Organic Maps - OSM data timestamp):
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/#auto/en/"+noteText)}else{alert("This%20is%20not%20a%20valid%20OSM%20note%20page.")}})();

1 post - 1 participant

Read full topic


Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/bookmarklets-helpers-for-solving-osm-notes/105805