Closed zrg1993 closed 5 months ago
Hello there, thank you for opening an issue. As for your example:
point1
can be a staypoint, as in the linked paper staypoints are possible with only one measurement.point2
is only a staypoint if the following measurements (positionfixes
in trackintel terminology) exceed the distance threshold and the time threshold. And there if there is no larger gap, due to the following linesIf that answered your question, please let me know. Otherwise, it would be really helpful if you could state your issue with the code and provide an minimal code example that produces said issue. (Then maybe @hongyeehh could help?)
@bifbof Thank you for the response. Here is the data I am using for test. I just set the different longitude and time for each point.
lat,lon,elevation,time,User,geometry 39.98470,116.31842,149.9616,"2008-10-23 02:45:04+00:00",0,"POINT (116.31842 39.98470)" 39.98470,115.31842,149.9616,"2008-10-23 02:53:04+00:00",0,"POINT (115.31842 39.98470)" 39.98470,115.31843,149.9616,"2008-10-23 02:54:04+00:00",0,"POINT (115.31843 39.98470)"
And the staypoints result is :
I am wondering that the staypoint does have the started_at
and finished_at
.
The test case output above on started_at
and finished_at
will have conflict with the staypoint geometry.
The output I except will be the final two points:
started_at : point2
finished_at : point3
Looking forward to your reply. Thanks.
Hi, I think the issue is regarding the time and geometry assignment of staypoints:
started_at
is the first pf's timestamp that belongs to the sp, and finished_at
is the first pf outside the sp. This follows the original algorithm and is described in the notes section: Let me know if that clarifies the issue
@hongyeehh
Thanks for your reply.
Would you like to check the output I uploaded again?
The started_at
and finished_at
timestamp are including the trip distance exceed the dist_threshold
parameter.
The conflict I am meaning is the started_at
and finished_at
is not the correct output on the sample data.
I found a lot of implementations of Li et al. (2008) paper did not consider the case I mentioned. Would you like to check the logic on the first two points in the sample data above again?
I am trying to understand the issue.
Do you anticipate two staypoints being generated based on the sample data you provided? One is shown in your screenshot, and the other is from points 2 to 3.
You can pass include_last=True
, so the function will consider/aggregate pfs at the end of the tracking.
@hongyeehh
Thanks for your advice.
And I draw the image of current output which should not been considered as one staypoint no matter include_last
is set to True
or False
.
I am afraid I do not understand the issue. Please open a new issue with the bug template if you think the bug persists.
The question is if the distance between point1 and point2( e.g. point1 : Tokyo, point2 : Beijing) is larger than dist_threshold
and the time difference is larger than time_threshold
, the output will regard the point1 and point2 as one stay.
@bifbof Thank you for the response. Here is the data I am using for test. I just set the different longitude and time for each point.
lat,lon,elevation,time,User,geometry 39.98470,116.31842,149.9616,"2008-10-23 02:45:04+00:00",0,"POINT (116.31842 39.98470)" 39.98470,115.31842,149.9616,"2008-10-23 02:53:04+00:00",0,"POINT (115.31842 39.98470)" 39.98470,115.31843,149.9616,"2008-10-23 02:54:04+00:00",0,"POINT (115.31843 39.98470)"
And the staypoints result is :
I am wondering that the staypoint does have the
started_at
andfinished_at
. The test case output above onstarted_at
andfinished_at
will have conflict with the staypoint geometry. The output I except will be the final two points:started_at : point2 finished_at : point3
Looking forward to your reply. Thanks.
From your provided demo, the staypoint is only formed from Point 1. Point 2 is thus the first point outside this staypoint.
@hongyeehh Thank you very much. I understand the finished_at
meaning now.
For example, there are three points like
[point1, point2, point3]
.When
distance(point1, point2) > dist_threshold
, and thetime_threshold
also satisfies the condition.The first two points
[point1, point2]
will be considered as statypoint.https://github.com/mie-lab/trackintel/blob/0cc1782b6e48ba52f9aac63a8b13822e67da1aa5/trackintel/preprocessing/positionfixes.py#L496-L502