Google Maps & apps with mapview have different cur

2019-01-17 13:03发布

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?

3条回答
萌系小妹纸
2楼-- · 2019-01-17 13:33

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 ?! :(

查看更多
smile是对你的礼貌
3楼-- · 2019-01-17 13:46

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.

查看更多
手持菜刀,她持情操
4楼-- · 2019-01-17 13:49

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.

查看更多
登录 后发表回答