Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two GPS devices, one from NMEA and one from Garmin. I would like to know if it’s possible to use either of them to provide more accurate location for browsers (Chrome, Firefox).

The web application I have works great on tablets with integrated GPS, but not with laptops.

share|improve this question

migrated from Jul 24 '12 at 21:02

This question came from our site for professional and enthusiast programmers.

which OS? the OS will need to support APIs for this.. – tumchaaditya Jul 27 '12 at 4:06
Why do you want to use GPS device with laptop while you can easily get your location by using wi-fi or if you have internet access. That's fairly accurate isn't it? – Zack Titan Jul 27 '12 at 9:38
@TitanZack: The wi-fi geolocation thing is basically a "hack" that relies on the presence of many nearby, long-running wifi networks. It is ineffective in many environments, such as out in the country where you're the only wifi network, or if you don't have a wireless chipset in your PC. And in general it's pretty much just an attempt to tell the ballpark of where you are. Nothing about WiFi translates directly to location; it's all based on experimental data and statistics. GPS is accurate down to the meter regardless of where you are, as long as you're on the surface of the Earth. – allquixotic Jul 27 '12 at 13:39

In order to get this working on a laptop, you'll need to have support "throughout the stack" as follows:

  • Driver support - The laptop must have hardware drivers that can recognize the GPS device and interface with it, whether it's over USB or some other protocol. The drivers are usually implemented in the kernel, but if you know for a fact that you have correct drivers, the implementation is not important to you.
  • Userspace APIs that use the drivers - No matter what the driver interface is or how it works, the userspace stack must be aware of the presence of the hardware GPS device, and must know how to access the hardware through a programming interface. If you have drivers ofr a GPS device, then you probably also have a userspace programming interface for it... but do you have the next part?
  • Applications that use the userspace APIs - Your client application (presumably a web browser) must be aware of the userspace driver API and be able to use it gainfully to support location services.
  • Application must support a location protocol compatible with the web application that is querying it -- The W3C standard for endpoint geolocation is the W3C Geolocation API so that's a good place to start. The browser must basically understand that when the web server asks for the location, the browser "understands" the request well enough to know that it needs to get geolocation data from the user.
  • Application must integrate the driver into the location protocol as a supported backend.

So you end up with a technology stack something like this:

Kernel drivers <--> Userspace drivers/libraries <--> Web browser geolocation backend specific to your device's userland libraries or framework <--> Web browser protocol layer that understands an HTTP based geolocation request API, such as the W3C Geolocation API.

Right now I think the pieces that are most likely to already be available are:

  • The kernel drivers and userspace libraries for the device should be provided by the manufacturer.
  • the W3C Geolocation API is supported for a long time in Chrome and Firefox.

The piece that are likely to be missing is the "Web browser geolocation backend".

That is, I doubt that Firefox/Chrome actually has hardware integration support for GPS devices. There is only one implementation I'm aware of right now: Firefox has support for GPSd devices. So if your device integrates with the GPSd middleware and your operating system is one of the supported ones, it's possible. Otherwise, likely not (although it could vary if the manufacturer decides to support the entire stack, including a browser plugin).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .