NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Ok here's the story so far... I'm a beginner programmer messing around with the GPS functionality on my browser, Google Chrome. I'm looking at different tutorials for displaying the current location of the user on a website @ W3schools and I decide to see it it were possible to do the same with Open Street Map, instead of Google Maps. How can I utilize the OSM api to take the latitude and longitude returned from my browser? I've messed around with the default iframe offered by the OSM website, but to no avail. Any tips?

asked 05 Jun '15, 13:17

roughlycuboid's gravatar image

roughlycuboid
11112
accept rate: 0%


For a bit of background about creating a simple browser-based map that uses map tiles from OSM, have a read of this:

https://switch2osm.org/using-tiles/getting-started-with-leaflet/

Leaflet (the Javascript library) supports a "locate" call - see http://leafletjs.com/reference.html . That allows you to centre the map display using the HTML Geolocation API.

permanent link

answered 05 Jun '15, 13:31

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×235
×111
×76
×25
×19

question asked: 05 Jun '15, 13:17

question was seen: 6,602 times

last updated: 05 Jun '15, 13:31

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum