Android GPS 坐标分散

时间:2023-03-22
本文介绍了Android GPS 坐标分散的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

下面的代码似乎工作正常:

<块引用>

//GPS 阅读器//标准标准标准 = 新标准();//criteria.setAccuracy(Criteria.ACCURACY_COARSE);//当我们无法获得 GPS 定位时使用标准.setAccuracy(标准.ACCURACY_FINE);//当我们可以获得 GPS 定位时使用标准.setAltitudeRequired(false);标准.setBearingRequired(false);标准.setCostAllowed(true);标准.setPowerRequirement(Criteria.POWER_LOW);LocationListener locationListener = new MyLocationListener();LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);lm.requestLocationUpdates(lm.getBestProvider(criteria, true), 0, 0,位置监听器);

但是,当我在 Google 地图上绘制我收集的数据时,GPS 坐标在某些情况下非常分散,或者它会沿着我正在行走的路径前进,然后突然跳转到一个点一英里外然后回来.有没有什么办法解决这一问题?我猜是某种准确性检查?

更新:

基本上我的问题看起来像这样 - GPS抖动

更新 2:

我考虑过不要把它作为赏金,但我想我不妨完全了解这里发生的事情,看看我的方法是否过度杀戮.尽管我的精度为 3m 等,但我仍然遇到同样的问题,即我的坐标中有抖动.现在这可能是可用的卫星等.我不知道,但基本上我想了解如何所有这些其他应用程序,尤其是运动应用程序,是否能够在相同的情况下获得如此流畅的读数.

我在 Quora 上找到了这个 是否有任何正在运行的应用程序具有过滤 GPS 数据以获得更准确跟踪的功能? 不幸的是,它并没有提供太多洞察力进入我的问题,除非您可以根据需要使用卡尔曼滤波器,但肯定必须有不太复杂的方法,因为我怀疑大多数应用程序都实现了这一点.

无论如何,如果有开发人员想分享他们正在做的一些伪代码,我们将不胜感激.我的意思是,如果我坚持使用 Kalman,我会坚持下去,但我确信必须有更容易实现的算法,并且希望学习这些算法以及如何实现它们,这很合适.

上下文:这是一个移动行人应用程序.

我试图从中收集信息的相关 SO 问题从一系列 GPS 坐标创建平滑曲线平滑 gps 数据:这是一个好的开始,虽然我不确定我需要实现什么伪代码正确地让最小二乘拟合正常工作,这样我就可以得到一个样条 GPS 数据,然后我可以在谷歌地图之类的东西上查看它,以确认我做得正确.我认为问题在于,如果这是我正在处理的一般 X 和 Y 数据,而不是 GEO 坐标,我可以在 matlab 中写一些东西来测试它,然后继续.

更新 3

我收到的混乱 GPS 数据的图像https://www.dropbox.com/s/ilsf8snao2no65e/gpsdata2.png

代码https://gist.github.com/4505688

解决方案

您得到的是因为您的标准将最佳提供商标识为 NETWORK_PROVIDER.它不会识别您的位置,而是为您提供覆盖您设备的手机信号塔的位置.因此,当您在任何建筑物之外时,最好使用 GPS_PROVIDER 来获得精确的地理位置.为什么你得到分散的坐标是因为你的设备进入了另一个蜂窝塔的范围,因此发生了位置跳跃.直接使用 GPS_PROVIDER 是您将获得的最佳解决方案.

I have the following code below which seems to be working fine:

    // GPS Reader
    // Criteria
    Criteria criteria = new Criteria();
    //criteria.setAccuracy(Criteria.ACCURACY_COARSE); // Used when we can't get a GPS Fix
    criteria.setAccuracy(Criteria.ACCURACY_FINE); // Used when we can get a GPS Fix

    criteria.setAltitudeRequired(false);
    criteria.setBearingRequired(false);
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW);

    LocationListener locationListener = new MyLocationListener();
    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    lm.requestLocationUpdates(lm.getBestProvider(criteria, true), 0, 0,
            locationListener);

However, when I graph the data I have collected on Google maps, the GPS coordinates are very scattered in some instances, or it will be going along a path I am walking just find and then all of the sudden jump to a point a mile away and then back. Is there any way to fix this? Some sort of accuracy check I guess?

Update:

Basically my problem looks like this as an example - GPS Jitter

Update 2:

I considered not making this a bounty but I figured I might as well get a complete understanding of what is going on here, and see if maybe my approach is over kill. I still have the same problem that my coordinates have jitter in them despite the fact that I have accuracies of 3m, etc. Now this could be to available satellites, etc. I don't know, but basically I'm trying to understand how are all these other applications, especially the exercise apps, able to get such smooth readings under the same circumstances.

I was on Quora and was able to find this Does any running app have a feature of filtering GPS data to get more accurate tracking? Unfortunately it didn't give much insight into my problem, except you can use a Kalman filter if you want, but surely there has to be less complex means, since I doubt most apps out there are implementing this.

Anyways if a fellow developer would like to share what they are doing with some pseudocode that would be greatly appreciated. I mean if I'm stuck with Kalman I am, but I am sure there have to be easier to implement algorithms, and would hope to learn those and how to implement them, that are decent fits.

Context: This is a mobile pedestrian application.

Relevant SO Questions I have tried to glean information from Create a smooth curve from a series of GPS coordinates Smooth gps data : This was a good start, though I am not sure what pseudocode I would need to implement to properly get the Least Squares Fit to work appropriately so that I will have a splines GPS data which I can then view on something like google maps to confirm I did it correctly. I think the issue is if this was general X and Y data I was dealing with, and not GEO coordinates, I could write something up in matlab test it, and go on.

Update 3

An image of the messed up GPS data I am recieving https://www.dropbox.com/s/ilsf8snao2no65e/gpsdata2.png

Code https://gist.github.com/4505688

解决方案

What you are getting is because your criteria identifies best provider as NETWORK_PROVIDER. Which does not identify your location but instead gives you the location of the cell tower whose range covers your device.So when you are outside of any building it is better to use GPS_PROVIDER to get fine accuracy of Geo locations.Why you get scattered co-ordinate is because your device comes to range of another cell tower hence location jump happens. Directly use GPS_PROVIDER is the best solution you will ever get.

这篇关于Android GPS 坐标分散的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:Android:使用 html5 使用 javascript api 确定 webview 中的地理位置 下一篇:LocationClient 与 LocationManager

相关文章