Robert Eisele
Systems Engineer, Architect and DBA

Using GPS with node.js and JavaScript

GPS is probably the best known global positioning system, even if there are other countries besides America who built up their own, like Europe with Galileo, Russia with GLONASS and the newest, BeiDou in China. All are based on the same technique, a triangulation of spheres, whose radius is the signal transfer time, given by an atomic clock on the satellite. In general, the more satellites you use this way, the better the accuracy of the determination of the location and some receivers already combine the varying systems.

The hard part in any case is done by the GPS receiver, which interprets the signals and either returns the data in binary form, or the more common NMEA protocol. I wrote a NMEA implementation in JavaScript, which does a lot of nasty work for you. Most NMEA implementations do not much for you, they split the string and you still have to know NMEA at great detail on how to work with the data.

GPS.js is actually doing much more. It normalizes the data and keeps a state object, which represents the latest information of the position, the errors, the time and satellite positions. The library comes with quite some examples, like plotting the current position on Google Maps or displaying the current information on a simple dashboard and so on. If you've a receiver lying around, just fish it out of your electronics box and try it yourself. If you still need a receiver, I can recommend this one as a cheap starting option or if you can work with a soldering iron, I recently published an article about the NEO6Mv2 module.

More information and code snippets can be found and Github!

You might also be interested in the following

 

Sorry, comments are closed for this article. Contact me if you have an inventive contribution.