Google Maps → OpenStreetMap button

Adds a button in Google maps which opens the same map in OpenStreetMaps

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

Автор
KrzysiuNet
Инсталации дневно
0
Инсталации общо
2
Рейтинг
0 0 0
Версия
0.3
Създаден
24.01.2026
Обновен
24.01.2026
Размер
3 КБ
Лиценз
MIT
Работи на

Description

This userscript adds button on the bottom of the Google Maps map view, which takes you to OSM with virtually the same view - same coordinates and virtually the same zoom. As Google Maps URL is dynamic, this script, of course, takes current URL, not initial one

Rationale

I often use maps to identyfy places. Google Maps for: 1) satellite 2) StreetView 3) [rarely, but] some objects are more visible than on OSM 4) to quickly copy coordinates to clipboard - for me it's essential and GMaps is just rclick->clickon the first position in menu 5) good search function, OSM is awful when it comes to that.

But OSM has own good points, like: 1) it's more up-to-date 2) ideological - FLOSS, community driven, virtually no spting 3) as with 3 from GMamps - some objects are present, when GMaps misses it 4) buildings numbers - again essential for me 5) programmable via Leaflet (map tiles) and Nominatim (API for geocoding)

So, as you see I'm not interested in "redirect GM to OSM". I want a way to go from GM to OSM.

Config:

  • on the top of the code, there's newTab abd addPin - you can safely customize it to your likings
  • changebtn.textContent = ... to customize button label
  • object that starts with Object.assign(btn.style, { - it's a button style in CSS (formatted as property: "value", - if you know css basics, you can customize it right there. If you don't, you may guess what does what.

Maybe todo:

  • change div to a href, so user could copy or middle click on it (due to dynamic URL, it would need a timer, which would in theory take precious CPU cycles
  • add ability to go back (well, for now, if you open GM and then switch OSM you can always go back by clicking <- button in your browser (or middle click it, to open previous URL, i.e. GMaps in new tab)
  • get rid of the setInterval