Skip to content

gerhynes/geolocation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geolocation, Speedometer, and Compass

A page built to practice using geolocation data. Built for Wes Bos' JavaScript 30 course.

Screenshot of geolocation page

Notes

Geolocation provides more than just latitude and longitude. Heading, for example, tells you how many degrees off north you are, as well as your speed.

You cannot access gelocation unless you are on a secure origin.

Xcode can simulate heading, whereas Chrome, Firefox etc. cannot, so this project doesn't have full functionality.

So in theory:

Select the compass arrow and the speed value.

Listen for the user's position using navigator.geolocation.watchPosition.

getCurrentPosition will give you your current position at time of asking. watchPosition will observe your position and update the geolocation data.

Update the speed value. speed.textContent = data.coords.speed;

Rotate the compass depending on the heading.

arrow.style.transform = `rotate(${data.coords.heading}deg)`;

Add an error callback and alert the user if they haven't allowed acces to their location.

About

A page built to practice using geolocation data. Built for Wes Bos' JavaScript 30 course.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors