Bookmarklet osm-google maps
		
		
		
		Jump to navigation
		Jump to search
		
This bookmarklet enables you to jump from a osm.org map to google maps at the same position and zoom and vice versa.
Bookmarklet
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.google.com/maps/@"+params[2]+","+params[3]+","+params[1]+"z");}else{params=location.href.match(/www\.google\.[a-z]{2,4}(?:\.[a-z]{2})?\/maps\/.*@(-?\d{1,3}\.\d+),(-?\d{1,3}\.\d+),(\d+\.?\d{0,2})(a|m|z)/);if(params!=null){switch(params[4]){case"z":z=params[3];break;case"m":z=20-Math.log(params[3]/86.875)/Math.log(2);break;case"a":z=20-Math.log(params[3]/186.0278)/Math.log(2);break;}window.open("http://www.openstreetmap.org/#map="+Math.round(z)+"/"+params[1]+"/"+params[2]);}else{alert("openstreetmap%20%3C-%3E%20google%20maps\nimpossible");}}})()
Readable version
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.google.com/maps/@" + params[2] + "," + params[3] + "," + params[1] + "z") ;
  }
  else {
    params = location.href.match(/www\.google\.[a-z]{2,4}(?:\.[a-z]{2})?\/maps\/.*@(-?\d{1,3}\.\d+),(-?\d{1,3}\.\d+),(\d+\.?\d{0,2})(a|m|z)/) ;
    if (params != null) {
      switch(params[4]) {
        case "z": z = params[3] ; break ;
        case "m": z = 20 - Math.log(params[3] / 86.875) / Math.log(2) ; break ;
        case "a": z = 20 - Math.log(params[3] / 186.0278) / Math.log(2) ; break ;
      }
      window.open("http://www.openstreetmap.org/#map=" + Math.round(z) + "/" + params[1] + "/" + params[2]) ;
    }
    else {
      alert("openstreetmap <-> google maps\nimpossible") ;
    }
  }
}
)()
Bookmarklet for opening current view (OSM or GMaps) in OSM editor
This is an edited version of the above bookmarklet which opens the current view for editing in the OSM iD editor. You need to be logged in.
Bookmarklet
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.openstreetmap.org/edit#map=" + params[1] + "/" + params[2] + "/" + params[3]) ;
    }
    else {
        params = location.href.match(/www\.google\.[a-z]{2,4}(?:\.[a-z]{2})?\/maps\/.*@(-?\d{1,3}\.\d+),(-?\d{1,3}\.\d+),(\d+\.?\d{0,2})(a|m|z)/) ;
        if (params != null) {
            switch(params[4]) {
                case "z": z = params[3] ; break ;
                case "m": z = 20 - Math.log(params[3] / 86.875) / Math.log(2) ; break ;
                case "a": z = 20 - Math.log(params[3] / 186.0278) / Math.log(2) ; break ;
            }
            window.open("https://www.openstreetmap.org/edit#map=" + Math.round(z) + "/" + params[2] + "/" + params[1]) ;
        }
        else {
            alert("google maps->OSM edit\nimpossible") ;
        }
    }
}
)()
You can also edit in the Strava iD fork if you replace
"https://www.openstreetmap.org/edit#map="
with
"http://strava.github.io/iD/#background=Bing&map="
(This is more useful than having a bookmarklet that does the same thing as clicking "edit")
Credits
Author : the_knife
Licence : "copyleft"