Google Maps & apps with mapview have different current positions
Asked Answered
M

3

8

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

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?

Menorrhagia answered 20/7, 2010 at 10:27 Comment(3)
Is it possible that google maps is just using the last location it got from GPS, since via network it knows you haven't gone very far? In other words, google maps app knows you went inside (since GPS went away but network location is still avaliable), and so it stores the last known GPS point and uses that?Penninite
I don't think so. I ran all applications at the same times, therefore the position shouldn't differ at the same time. Just a few minutes ago I also tested it outside and also went on a bus for a longer distance. The google maps API tiles are definitely inaccurate, see my answer below which basically kind of proves it. Also I tested with GPS entirely off an only using GSM/Wifi, it all results to the same. Furthermore, getLastKnowLocation is system-wide, not app-wide. If Google Maps uses it, I should also get the same position in my app.Menorrhagia
In fact, I probably get the same lat/lng from getLastKnowLocation as Google Maps does, but it's just displayed wrongly on differnt inaccurate map tiles (see answer below as an example from the web api).Menorrhagia
M
2

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/img339/2793/gmaps2.png 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 ?! :(

Menorrhagia answered 20/7, 2010 at 12:44 Comment(1)
Update: interestingly, the satellite view seems to be quite accurate, only the street view is not. Means, overlaying satellite with street view doesn't seem to match, probably due to different map content providers. Best to always use satellite view, at least in rural areas where map material is inaccurate.Menorrhagia
K
2

I know your post is one-year old, but the answer I think is that: Google map data in China is offset or distorted. I notice that you are in South China. The China government requires that for some security reasons. Here is the Google search results.

The transformation algorithm is unknown. Probably you can Google it, and wish you good luck.

Klug answered 23/6, 2011 at 1:27 Comment(1)
Hi Frank, thanks for the hint, I wasn't aware of it, but it makes sense.Menorrhagia
G
0

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.

Gorgias answered 22/7, 2010 at 15:31 Comment(2)
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: forum.sdx-developers.com/android-2-1-development/…), 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.Menorrhagia
> "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.Menorrhagia

© 2022 - 2024 — McMap. All rights reserved.