Question

Here's my situation; I've built a very simple web app that looks up a users location and plots it on a Google map. Here's my code: http://pastebin.com/d3a185efd

When I test it, my location is detected as being >= 500 meters from where I actually stand.

BUT

When I open up Google Maps or Gowalla my location is correct to within <20 meters?

So my question is: Do native iPhone apps benefit from a higher accuracy rate than web apps?

If so, why?

Was it helpful?

Solution

According to the specification, webapp geolocation should use whatever positioning method works best in any situation - so in theory, one would assume it uses GPS when available. The discussion linked in the "best answer" by rohit doesn't seem conclusive to me - here is another one, with someone reporting a similar problem to yours and other users professing to getting accurate gps data (scroll down to comments 26-28 Sept):

http://www.thecssninja.com/javascript/geolocation-iphone

But it does seem like the geolocation stuff is buggy still. I'd suspect your problem is basically that, some bug.

OTHER TIPS

Based on the following link, I believe you are getting coordinates in web app through tower triangulation and not using GPS. I really doubt if GeoIP can give coordinates within 500 meters.

http://phonegap.lighthouseapp.com/projects/20116/tickets/16-navigatorgeolocation-does-not-make-use-of-gps-data

The geolocation API allows for a high accuracy parameter.
http://dev.w3.org/geo/api/spec-source.html#position_options_interface
(But uses extra battery, so probably best use sparsely)
Have you tested that?

Boolean: enableHighAccuracy

I think you are getting different results since you are overlooking the aspect of time. The GPS uses lots of battery and only starts up on command.

The HTML5 getCurrentPosition takes a snapshot of the coordinates before the GPS has had a chance to accurately 'zone in' on your position. The Google Maps app on the other hand starts and then watches your position, accuracy increasing over time (you all know how the marker moves). HTML5 also supports this feature of watching the position.

Side note! In my experience from the iPhone, the device will actually store your position for a little while, meaning that if I start up Google Maps and let it 'zone in' on my position, close it and THEN start my webapp and use getCurrentPosition I get an equally accurate reading.

Accuracy is all about letting the GPS do its thing..

I think that a webapp relies on a geoip service that (does its best to...) converts your IP address into a GPS coordinate. ex: service ex

However such way to retrieve a coordinate cannot be as accurate as the "classic" one that uses a GPS device (such as the one included in the 3G or 3Gs iphone) to really retrieve your actual location and not approximate it at its best like a geoip service.

UPDATE: GEOIP is used when using google maps on a laptop for instance, but maybe your question was : "when I use the HTML 5 position object in my web page, does it comes from the GPS hardware or from a geoip service ?". This I couldn't really tell, I would say it uses geoip service instead of GPS hardware but I'm not 100% sure...

for google geo api first it tries to find your location by device gps , if failed it goes cell triangulation (virtual gps) if failed it try to use to wifi mac and ip addresses , the last try is to use the client IP to get his location

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top