Bookmarklet OSM <--> Mapillary to rapidly switch between the two
Posted by Romainbou on 4 July 2017 in English. Last updated on 13 July 2017.Hi all, I just adapted an OSM <–> Google Maps bookmarklet made by The_Knife, into OSM <–> Mapillary.
I find the Mapillary integration into iD quite usefull of course, but having everything drawn on the same window makes the whole thing very messy and hard to read. I always ended by opening a new tab for Mapillary navigation, and staying with a clear OSM window to work on.
The bookmarklet just open a new tab at the exact same place and zoom, in the other service, in both ways osm->mapillary and mapillary-osm.
So you just have to create a new bookmark in your favorite browser, and copy-paste the text below as the url field :
javascript:(function(){params=location.href.match(/openstreetmap.org.+#map=(\d{1,2})\/(-?\d{1,3}.\d+)\/(-?\d{1,3}.\d+)/); if(params!=null){ window.open(“https://www.mapillary.com/app/?lat=”https://wiki.openstreetmap.org/wiki/Tag:+params[2]+”&lng=”+params[3]+”&z=”+params[1]);}else{params=location.href.match(/www.mapillary.com\/app\/.+lat=(-?\https://wiki.openstreetmap.org/wiki/Tag:d{1,2}.\d+)&lng=(-?\https://wiki.openstreetmap.org/wiki/Tag:d{1,2}.\d+)&z=(\d{1,2}.?\d)/); if(params!=null){ z=params[3];window.open(“https://www.openstreetmap.org/#map=”+Math.round(z)+”/”+params[1]+”/”+params[2]);}else{ alert(“OpenStreetMap - Mapillary impossible”);}}})()*
Here is the wiki page of the bookmarklet : Bookmarklet OSM-Mapillary
PS : the OSM <–> Google Maps bookmarklet can be found here and is extremelly useful. The_Knife also made a one way “->OSM” version of his bookmarklet, that is compatible with more url types :
0/0.000/0.000
or zoom=0&lat=0.000&lon=0.000 (can be in an other order and not in a straight string !)
And there is also a huge bookmarklet, MapJumper, that seems to allow switching between OSM and 35 other services, but I didn’t see mapillary in the list!
Romain
edit : Philipc enhanced the code today and I updated the text of the code written on this article accordingly.
Paris, oui on s’en doute : les grands boulevards sont bien là. Ils sont relativement bien organisés, du fait de leur histoire. Le mot boulevard était avant utilisé pour dénommer des rajouts aux fortifications des remparts d’une ville, dans le but de mieux les protéger après l’invention des… boulets de canon. Je laisse la suite du récit à Wikipedia qui dit absolument bien les choses :