OpenStreetMap logo OpenStreetMap

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=”+params[2]+”&lng=”+params[3]+”&z=”+params[1]);}else{params=location.href.match(/www.mapillary.com\/app\/.+lat=(-?\d{1,2}.\d+)&lng=(-?\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.

Discussion

Comment from transilien_cartocite on 5 July 2017 at 06:18

Thank you Romain, it’s very useful !

Comment from StephaneP on 5 July 2017 at 06:22

Wooops ! I forgot to change my account !

Comment from Romainbou on 5 July 2017 at 17:07

merci Stéphane ! Comme je mets en post scriptum : je t’encourage à utiliser aussi les 2 bookmarklets de The Knife : OSM<–> Google Maps et ->OSM. En se laissant guider dans le wiki.osm, on tombe sur un méga bookmarklet MapJumper, mais je n’ai pas réussi à le faire fonctionner. Il permet de switcher entre 35 services, mais il n’y a pas Mapillary en tout cas.

Comment from philippec on 6 July 2017 at 13:23

Yesterday I did not know what a bookmarklet was, and today I cannot live without. I have the impression that Mapillary needs some time open, before it can switch to OSM.

On the other hand I find it sad that gibberisch as java and python have conquered the world. BASIC was really democratic, for the common man.

Comment from philippec on 13 July 2017 at 13:13

There is a new version on the wiki page that handles two more Mapillary url variants.

Log in to leave a comment