Email or username:

Password:

Forgot your password?
Top-level
OpenCage πŸ‘‰πŸŒ

4/ How exactly the browser determines the location varies.

It may be from GPS πŸ›°οΈ or cell towers πŸ—Ό(on mobile) or wifi πŸ“Ά or IP-to-location. each of these methods have pros and cons.

Developers can ask the browser for a more or less accurate location.

Here's what that looks like in basic javascript:

#geoeducation

screenshot from the OpenCage browser geolocation tutorial showing how to trigger browser geolocation in javascript
Documentation explaining the meaning of the optional `enableHighAccuracy` value
Methods of establishing browser location
6 comments
OpenCage πŸ‘‰πŸŒ

5/ Assuming the user gives permission πŸ‘, the browser then receives a longitude and latitude, and potentially other info like altitude.

Important: depending on the tech used these coords may be more or less accurate πŸ‘‰πŸŒ The accuracy value is a number in meters that the actual position may vary from the reported position.

developer.mozilla.org/en-US/do

Note: browsers also allow users to turn off location prompting.

#geoeducation

screenshot from the OpenCage browser geolocation tutorial showing how to access the coordinates returned by a successful request for location
Screenshot of the settings panel in Firefox (Preferences > Privacy & Security > Permissions > Location) where a user can disable location requests.
OpenCage πŸ‘‰πŸŒ

6/ ok, so now we have geographic coordinates!

We use them as inputs into reverse geocoding, which is turning coordinates into location human-readable location info.

You may recall our #geoeducation thread about the nuances of reverse geocoding en.osm.town/@opencage/11174365

OpenCage πŸ‘‰πŸŒ

7/ We have a guide to this whole process of browser geolocation to geocoding with example javascript (where the code screenshots above came from)

opencagedata.com/guides/how-to

#geoeducation

screenshot from the OpenCage browser geolocation guide showing how to send the coordinates to the OpenCage geocoding API and get back useful geographic information about the location
OpenCage πŸ‘‰πŸŒ

8/ Want to see browser geolocation in action?

Give it a go on this OpenLayers tutorial:
openlayers.org/en/latest/examp

But make sure you haven't disabled geolocation in your browser settings. Some browsers helpfully show this in the nav bar.

Please note also that if browser location relies on IP geolocation it can be misled by VPNs.

#geoeducation

example of Chrome showing that browser geolocation has been blocked
OpenCage πŸ‘‰πŸŒ

9/ Wrapping up - browser location is an interesting tool that can be used to improve the user's web application experience.

But ... it requires user permission, and even if that permission is granted it can be inaccurate or misleading.

πŸ‘©β€πŸŽ“ Want to learn more? Here's the official W3C geolocation spec: w3c.github.io/geolocation-api/

#geoeducation

OpenCage πŸ‘‰πŸŒ

10/ Thanks for reading (and sharing) this week's #geoeducation πŸŒπŸ§‘β€πŸŽ“thread.

If you found this interesting you may also like our thread about the details of IP geolocation:
en.osm.town/@opencage/11068468

or our thread about the privacy implications of geocoding:
en.osm.town/@opencage/11226344

We have links to many more geothreads about geospatial technologies, #geoweirdness of individual countries, geocoding, border disputes, etc listed on our blog:
blog.opencagedata.com/geothrea

10/ Thanks for reading (and sharing) this week's #geoeducation πŸŒπŸ§‘β€πŸŽ“thread.

If you found this interesting you may also like our thread about the details of IP geolocation:
en.osm.town/@opencage/11068468

or our thread about the privacy implications of geocoding:
en.osm.town/@opencage/11226344

Screenshot from the OpenCage geothreads page
Go Up