views:

208

answers:

2

I have a mapview where I want to track the user's current location. GPS as well as 'use wireless networks' is activated in my phone settings. Nevertheless, since I'm indoor I don't get a GPS fix, therefore the location is determined via network; wifi spot is available.

I have the Google Maps app running as well as my application running.

Strangely, the current location differes between Google Maps and my application, where the Google Maps is very accurate while in my app the location is somehow off a few 100 meters.

In my application I basically do the following (for debugging purposes now):

1) initially place one marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

2) initially place another marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

This will put the last known locations of both providers onto the map (eventually last known from outside my app).

3) then for the regular updates (since I don't get a GPS fix anyway indoor here), I do:

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, baseLocationListener);

You can see for the frequency and distance I pass the 0 param in both cases.

In the app manifest, the following permissions are granted:

android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_MOCK_LOCATION

Actually my baseLocationListener does get called, which I see in the log, but the updated location is somehow the same as the last known current position (of LocationManager.NETWORK_PROVIDER), same lat/lng.

I thought maybe I overlooked something or missed a parameter or setting, or my code has a bug. Therefore I installed some other (3 in total) LBS apps from the Android market that also show the current user's location. The current locations displayed in those apps are equals to the one in my application - and they're all some 100 meters off - but at least all the same.

See the screenshot here: screenshot

http://img33.imageshack.us/img33/8679/mapproblem.png

Now I am wondering:

1) as I understand, getLastKnowLocation is system-wide and not app-wide, why are there differences between the location in Google maps and all the other apps?

2) does Google Maps not update the lastKnownLocation of a provider?

3) does Google Maps use a different custom location provider (i.e. due to licensing reasons) other than GPS_PROVIDER or NETWORK_PROVIDER as they are in the SDK?

4) how do achieve the same accurate result with the NETWORK_PROVIDER like Google Maps does?

+1  A: 

I think I found an answer, although not a solution. It seems that the problem is in the data quality of the different map provider that are used for Google Maps and MapView in SDK, which differ.

The map tiles coordinates don't seem to be very accurate, just like in the public google maps web api / tiles.

See this screenshot for an example, where I pinned the same geo point. screenshot http://img339.imageshack.us/i/gmaps2.png/

The map using the public map api is off a few hundred meters. Seems that we just have to live with it ?! :(

Mathias Lin
A: 

The Map and Satellite images in Google Maps is off by a couple of meters, but I don't think it should be off that much. This seems to be a couple hundred meters.

Depending on how you acquired your position will dictate what position you get. From what I understand, these are the three levels of acquisition.

  • GPS
  • Network
  • WIFI

GPS and Network are determined by triangulation. GPS being the most accurate. WIFI is done using a "whois", an address is acquired and then geocoded, being completely inaccurate at times.

Some phones say they are GPS, but they are most likely Pseudo-GPS like the iPhone 1.

CrazyEnigma
Thanks for the explanation, but it doesn't really explain the behaviour I mentioned above. 'Google Maps' itself is not the problem, in fact, on Google Maps, the location is very accurate, it's only with MapView inside my app.Of course, accuracy of gps, wifi and gsm differ (a good description is here btw: http://forum.sdx-developers.com/android-2-1-development/cdma-lockup-wifi-use-wireless-networks-and-gps!/msg22834/#msg22834), but it should then be same to Google Maps as well as my MapView in my app. See my answer below and comments above, that's the logical explanation I found.
Mathias Lin
> "This seems to be a couple hundred meters.": But in fact: a few hundert meters do matter if your app is doing pedestrian navigation in a city where the streets are all nearby. With hundred meters off the entire navigation is useless.
Mathias Lin