Use a Web Browser & HTML5 to measure speed and heading of your car
HTML5 geolocation API to measure speed and heading of your car
![[IMG]](proxy.php?image=http%3A%2F%2Fwww.smartjava.org%2Fsites%2Fdefault%2Ffiles%2Fpictures%2Fspeed-heading.jpg&hash=a0d575f6e12ba92a2b7ccb9ca733e579)
Here you can see two gauges. One will show the heading you're driving to, and the other shows the speed in kilometers. You can test this out yourself by using the following link: Open #-Link-Snipped-# in GPS enable device. Once opened the browser will probably ask you to allow access to your location. If you enable this and start moving, you'll see the two gauges move appropriately.
Getting all this to work is actually very easy and consists of the following steps:
- Alter the SVG images so we can rotate the needle and add to page.
- Use the geolocation API to determine the current speed and heading
- Update the needle based on the current and previous value
0