OpenStreetMap and Geolocation

Inspired by johnath, here’s a bookmarklet you can use if you want to geolocate yourself on the OpenStreetMap map:

javascript:navigator.geolocation.getCurrentPosition(function(a){c=a.coords;window.location=”http://www.osm.org/?zoom=15&mlat=”+c.latitude+”&mlon=”+c.longitude;},function(){alert(“Rejected!”)});

It actually works a bit differently, because unlike Google Maps, OpenStreetMap doesn’t have a search box which takes you straight to a location. As a side-effect, you don’t need to be viewing OSM already to use it – it’s more like a bookmark.

One thought on “OpenStreetMap and Geolocation