Google Maps&使用mapview的应用程序有不同的当前位置 [英] Google Maps & apps with mapview have different current positions

查看:111
本文介绍了Google Maps&使用mapview的应用程序有不同的当前位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个mapview,我想跟踪用户的当前位置。 GPS以及'使用无线网络'在我的手机设置中被激活。
尽管如此,由于我在室内,我没有获得GPS定位,因此该位置是通过网络确定的;无线网点是可用的。



我有Google地图应用程序以及我的应用程序在运行。



奇怪地,当前位置在谷歌地图和我的应用程序之间不一样,谷歌地图非常准确,而在我的应用程序中,位置在某种程度上偏离了几百米。



在我的应用程序我基本上执行以下操作(现在为了调试目的):

1)最初在地图上放置一个标记:通过 locationManager.getLastKnownLocation (LocationManager.GPS_PROVIDER);



2)最初在地图上放置另一个标记:通过 locationManager.getLastKnownLocation (LocationManager.NETWORK_PROVIDER);



这会将这两个提供者的最后已知位置放到地图上(最终从我的应用程序外部最后知道) 。
$ b 3)然后进行定期更新(因为我无法在室内获得GPS修正),我这样做:

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

在这两种情况下,您都可以看到我通过0参数的频率和距离。



在应用清单中,授予以下权限:

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

其实我的baseLocationListener确实被调用,我在日志中看到,但更新的位置与最后一个已知的当前位置(LocationManager.NETWORK_PROVIDER)相同,经纬度相同。



我想也许我忽略了一些东西或错过了一个参数或设置,或者我的代码有一个错误。因此我从Android市场安装了其他一些(总共3个)LBS应用程序,这些应用程序还显示当前用户的位置。这些应用程序中显示的当前位置与我的应用程序中显示的位置相同 - 它们都距离约100米 - 但至少都是相同的。



在这里查看屏幕截图:
截图http://img33.imageshack.us /img33/8679/mapproblem.png



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



现在我想知道:



1)据我所知,getLastKnowLocation是系统范围的,而不是应用程序范围的,为什么Google地图中的位置与所有其他应用程序之间存在差异? 2)Google地图是否不更新提供商的lastKnownLocation?



b 3)Google地图是否使用除GPS_PROVIDER或NETW以外的其他自定义位置提供商(即由于许可原因) ORK_PROVIDER,因为它们在SDK中?



4)如何通过NETWORK_PROVIDER实现与Google地图相同的准确结果?

解决方案

我想我找到了答案,虽然不是解决方案。看起来问题在于用于Google地图和SDK中的MapView的不同地图提供程序的数据质量,它们有所不同。



t似乎是非常准确的,就像在公共Google Maps Web api / tiles中一样。



请参阅此屏幕截图,其中列出了相同的地理位置。
截图http://img339.imageshack.us/img339/2793/gmaps2 .png
http://img339.imageshack.us/i /gmaps2.png/



使用公共地图api的地图距离几百米。
似乎我们只需要忍受它?! :(

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?

解决方案

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

这篇关于Google Maps&使用mapview的应用程序有不同的当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆