首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在定位数据中检测GPS尖峰

在定位数据中检测GPS尖峰
EN

Stack Overflow用户
提问于 2021-01-07 16:52:58
回答 1查看 447关注 0票数 1

我有一个数据集,从我的谷歌帐户的GPS日志,我想从CSV删除离群点,显然是不打算在那里。

例如,GPS显示你在1,1 > 1,2 > 9,6 > 1,2 > 1,1,所以位置上的一个主要变化,几秒钟后回到了几秒前的地方。

我已经尝试过用GPS的速度进行过滤,但这可以移除在飞行中形成的GPS点。当全球定位系统正常时,这也不起作用,然后稍晚更新,然后上升到500公里之外,停留在那里10分钟,然后自我修正,因为移动速度会低到足以通过“速度测试”。

如何在约430 K行的数据集中检测到这些数据?就像在一架非常罕见的GPS更新的飞机上旅行一样,我们也需要处理这些问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-08 17:25:33

我已经决定了一个混合解决方案。

  • Velocity极限:i使用了地质模型的距离函数,计算出两个gps点之间的距离。根据csv的时间戳和距离,我计算了这些点之间的速度,如果它超过可以根据需要调整的某个阈值,它将不会将该点写入输出CSV

代码

代码语言:javascript
运行
复制
from geopy import distance
d1 = distance.distance(coords_1, coords_2)
d1 = float(str(d1)[:-3])*1000 # Convert to meters

FMT = "%Y-%m-%d %H:%M:%S" #Formatting so it matches CSV
Time = (datetime.strptime(cur_line["Time"], FMT) - datetime.strptime(pre_line["Time"], 
FMT)).total_seconds()
Velocity = d1 / Time
if Velocity < 800: # Set this to your needs
    # DO Stuff

余弦的

  • Law:计算三个点之间的角度,如果角度太窄,移除点

代码:

代码语言:javascript
运行
复制
from geopy import distance
from trianglesolver import solve
from math import degrees
d1 = distance.distance(coords_1, coords_2)
d2 = distance.distance(coords_2, coords_3)
d3 = distance.distance(coords_3, coords_1)
d1 = float(str(d1)[:-3])*1000
d2 = float(str(d2)[:-3])*1000
d3 = float(str(d3)[:-3])*1000

degTresh = 30.0
if d1 > 0.01 and d2 > 0.01 and d3 > 0.01: # if they are 0, there will be an error
    a,b,c,A,B,C = solve(a=d1, b=d2, c=d3) # Calculate the angles from the sides
    A,B,C = degrees(A), degrees(B), degrees(C) # Convert to math.degrees
    if (360.0 - degTresh) < C or C < degTresh:
        spike= True
    else:
        spike = False

这两种方法结合起来效果相当好,而且大多数情况下,当站着时,甚至会去除小的GPS尖峰。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65616638

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档