Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speed is always 0 #229

Closed
liucan233 opened this issue Dec 13, 2021 · 9 comments
Closed

speed is always 0 #229

liucan233 opened this issue Dec 13, 2021 · 9 comments

Comments

@liucan233
Copy link

liucan233 commented Dec 13, 2021

Describe the bug
In the results output using fmm or stmatch, the speed is always 0. Is the speed output by subtracting of longitude and latitude?I think the speed unit should be kilometers per second or something.
在运行fmm或者stmatch算法后,输出的结果中速度一直为0,速度是经纬度变化做减法得出的吗?我认为速度单位应该是千米每秒之类的。

Expected behavior

Get the average speed of each interval, in km / s or something.
得到每个间隔的平均速度,单位为km每秒等等

Screenshots
output
程序输出结果
speed

dataset
我的数据集
dataset

command arguments
命令参数
command

@cyang-kth
Copy link
Owner

你的数据包含很多的静止点,移动距离为0,所以速度为0.

@liucan233
Copy link
Author

你的数据包含很多的静止点,移动距离为0,所以速度为0.

感谢,但是前面几组数据似乎速度不应该为0,我在尝试运行更多数据集,看看速度是否为0,可以请问下速度的单位是什么吗?

@liucan233
Copy link
Author

liucan233 commented Dec 13, 2021

你的数据包含很多的静止点,移动距离为0,所以速度为0.

我更换了数据集,但是速度依然全部为0,@cyang-kth
new test

@cyang-kth
Copy link
Owner

可能是精度的原因,可以试试输出spdist来看看结果,可能是临近的点都匹配到端点上了,建议你需要对gps可视化看一下具体位置。

@liucan233
Copy link
Author

liucan233 commented Dec 13, 2021

可能是精度的原因,可以试试输出spdist来看看结果,可能是临近的点都匹配到端点上了,建议你需要对gps可视化看一下具体位置。

最短路径确实趋近于0
spdist

这是可视化结果
vis

以下是计算的速度

import pandas as pd
import transbigdata as tbd
# 读入GPS数据
data=pd.read_csv('./part_data.csv',sep=';')
data.tail(4)
id x y timestamp
26 0 104.059228 30.504364 1525170801
27 0 104.059088 30.504385 1525170804
28 0 104.059058 30.504385 1525170806
29 0 104.059038 30.504385 1525170808
# 创建新的df,用于错位存储经纬度
pointPair=pd.DataFrame()
pointPair['Lng1']=data.iloc[:-1,1:2]
pointPair['Lat1']=data.iloc[:-1,2:3]
pointPair['Lng2']=data.iloc[1:,1:2].reset_index(drop=True)
pointPair['Lat2']=data.iloc[1:,2:3].reset_index(drop=True)
pointPair.head(4)
Lng1 Lat1 Lng2 Lat2
0 104.061074 30.502242 104.061144 30.502372
1 104.061144 30.502372 104.061244 30.502602
2 104.061244 30.502602 104.061294 30.502732
3 104.061294 30.502732 104.061313 30.502772
# 求两点之间的距离
pointPair['Dis']=tbd.getdistance(pointPair['Lng1'],pointPair['Lat1'],pointPair['Lng2'],pointPair['Lat2'])
def getSpeed(row):
    return row['Dis'] / 3 * 3.6;
pointPair['speed(km/h)']=pointPair.apply(getSpeed,axis=1)
# pointPair=pointPair.drop(['speed','speed(km/sh)'],axis=1)
pointPair
Lng1 Lat1 Lng2 Lat2 Dis(m) speed(km/h)
0 104.061074 30.502242 104.061144 30.502372 15.914904 19.097885
1 104.061144 30.502372 104.061244 30.502602 27.280696 32.736836
2 104.061244 30.502602 104.061294 30.502732 15.213266 18.255919
3 104.061294 30.502732 104.061313 30.502772 4.837133 5.804560
4 104.061313 30.502772 104.061333 30.502802 3.841292 4.609550
5 104.061333 30.502802 104.061373 30.502881 9.674277 11.609132
6 104.061373 30.502881 104.061453 30.503041 19.348577 23.218292
7 104.061453 30.503041 104.061513 30.503181 16.576905 19.892286
8 104.061513 30.503181 104.061583 30.503331 17.956495 21.547794
9 104.061583 30.503331 104.061653 30.503461 15.915077 19.098092
10 104.061653 30.503461 104.061663 30.503491 3.467612 4.161135
11 104.061663 30.503491 104.061673 30.503511 2.418584 2.902301
12 104.061673 30.503511 104.061733 30.503621 13.497608 16.197129
13 104.061733 30.503621 104.061783 30.503741 14.162377 16.994853
14 104.061783 30.503741 104.061663 30.503951 26.030194 31.236233
15 104.061663 30.503951 104.061623 30.503951 3.824734 4.589680
16 104.061623 30.503951 104.061543 30.503981 8.350284 10.020341
17 104.061543 30.503981 104.061343 30.504021 19.641433 23.569719
18 104.061343 30.504021 104.061034 30.504092 30.659066 36.790879
19 104.061034 30.504092 104.060665 30.504162 36.236989 43.484386
20 104.060665 30.504162 104.060335 30.504203 31.872182 38.246618
21 104.060335 30.504203 104.060096 30.504243 23.381761 28.058113
22 104.060096 30.504243 104.059976 30.504263 11.690800 14.028960
23 104.059976 30.504263 104.059707 30.504304 26.203055 31.443666
24 104.059707 30.504304 104.059467 30.504334 23.193401 27.832082
25 104.059467 30.504334 104.059228 30.504364 23.193176 27.831812
26 104.059228 30.504364 104.059088 30.504385 13.572521 16.287025
27 104.059088 30.504385 104.059058 30.504385 2.868188 3.441826
28 104.059058 30.504385 104.059038 30.504385 1.912123 2.294548

@liucan233
Copy link
Author

problem
匹配似乎因为参数不巧当结果不太好

@cyang-kth
Copy link
Owner

cyang-kth commented Dec 13, 2021

你的r和gps_error设置有问题,需要缩小,单位是你的gps数据的单位,就是经纬度,速度的单位是经纬度每秒,参考#138 (comment)

@liucan233
Copy link
Author

你的r和gps_error设置有问题,需要缩小,单位是你的gps数据的单位,就是经纬度,速度的单位是经纬度每秒,参考#138 (comment)

你的意思是我的参数都给的太大了对吗(除了k),明天再试试,非常感谢你!!!

@liucan233
Copy link
Author

我经过了几次测试,得到了如下的结果
always 0
但是速度仍然有问题,某些点速度竟然达到了10的306次方,我应该继续优化参数吗
config
speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants