安卓GPS覆盖长区 [英] android gps cover long area

查看:118
本文介绍了安卓GPS覆盖长区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的GPS和我在地图上添加一些超过打下点,所以我希望在我目前的位置是==过外行项目中删除的项目!问题是GPS不准确,我可能会在附近的地方覆盖项目,但不一样的经度和纬度。所以我想周围的叠加添加项目区称增量这样的问题是增量假设是肯定它不能是整数或浮点数它应该是什么将它添加到我的了躺在项目朗和纬度。 预先感谢

i'm using gps and i add some over lay points in the map so i want when my current location is == the over lay item remove the item ! the problem is the gps inaccuracy and i may be in place near the overlay item but not same longitude and lat. so i want to add area around the overlay item say a delta so the question is what the delta suppose to be for sure its cant be int or float what it should be to add it to my over lay item lang and latitude . Thank in advance

推荐答案

我不是很有经验的GPS在Android上,但在我看来,你应该能够计算距离从当前位置到覆盖项目并检查是否小于某个可接受的阈值。这只是需要一点向量运算:

I'm not very experienced with GPS on Android, but it seems to me that you should be able to calculate the distance from your current position to the overlay item and check if it is less than some acceptable threshold. This just takes a little vector math:

int XSquared = Math.pow(myPosition.x - Item.x, 2);
int YSquared = Math.pow(myPosition.y - Item.y, 2);
double distance = Math.sqrt(XSquared + YSquared);

if(distance < threshold)
   removeItem(item);

显然,这不是在code实际上将是什么样子,但我希望它会给你一些想法,以什么你需要做的。

Obviously this is not what the code will actually look like, but I hope it will give you some idea as to what you need to do.

这篇关于安卓GPS覆盖长区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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