iPhone - Native App GeoLocation VS Web App GeoLocation
Asked Answered
S

7

7

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?

Subdue answered 21/1, 2010 at 15:38 Comment(0)
P
3

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.

Priorate answered 19/5, 2010 at 8:55 Comment(0)
D
1

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

Deianira answered 14/4, 2010 at 20:46 Comment(0)
R
1

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

Recitativo answered 28/1, 2011 at 8:9 Comment(0)
E
1

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..

Egest answered 5/1, 2012 at 11:5 Comment(0)
J
0

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...

Jerrelljerri answered 21/1, 2010 at 16:11 Comment(3)
That wasn't really my question as I'm sure the HTML 5 geolocation api checks whether your device is GPS capable and falls back to GeoIP if not. So my question still remains, do native iPhone apps use the same methodology (or one of equal accuracy) to web apps or are they superior in some way?Subdue
I think this relies on the implementation of the browser : let's suppose mobile safari checks the last retrieved location from the GPS hardware and returns it to the web page on demand, I don't see why there would be such a difference between webapps and native apps : the flow between webapp / objC would end up asking the same location.Jerrelljerri
That's what I thought, but if that's the case - why is there such a big difference in accuracy?Subdue
N
0

The code doesn't show where you get position from - are you using Navigator and Geolocation objects?

http://developer.apple.com/iphone/library/documentation/AppleApplications/Reference/SafariWebContent/GettingGeographicalLocations/GettingGeographicalLocations.html

Nejd answered 21/1, 2010 at 18:11 Comment(1)
Yes, my web app uses navigator.geolocation.watchPosition() for the iPhone and Android phones and navigator.geolocation.getCurrentPosition() for all others. I'm not sure what Google maps uses, but as it's web-based I'd imagine it uses the same JS.Subdue
C
0

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

Constituency answered 1/6, 2010 at 11:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.