movingpandas / qgis-processing-trajectory

Trajectory tools for the QGIS Processing toolbox
GNU General Public License v3.0
45 stars 16 forks source link

Trajectories from point layer: not ordered by time? #8

Closed d3d9 closed 5 years ago

d3d9 commented 5 years ago

For example with an input layer of bus stops, ordered by id (not by the time field that gets used as an input for the algorithm), the trajectory points end up being ordered as they were in the input layer and not ordered by time. Is this intended ("ordered by time" in the description only referring to the "list" of trajectories being ordered) or an error ("ordered by time" in the description actually referring to the trajectories' contents)?

anitagraser commented 5 years ago

The input data needs a timestamp. IDs are not supported. Points will be ordered by time before they are aggregated into trajectories.

anitagraser commented 5 years ago

Use Points to path for creating lines from points ordered by IDs.

d3d9 commented 5 years ago

The points do have a time field, but in the original layer they are not ordered by that. I don't want to create lines from points ordered by IDs, I want to have them ordered by time. When using the Trajectories from point layer algorithm (and selecting the time field and entering the time format) the points are not actually getting ordered by time, but they end up being ordered as they were, even though they have a time field, which I selected.

d3d9 commented 5 years ago

I tried to add sort_index() locally (line 51 in qgisUtils.py) and that made it work. Maybe the points are really not getting ordered by time in the current version of this code?

anitagraser commented 5 years ago

Thanks for catching that! I'll publish a fix.

anitagraser commented 5 years ago

Done: https://plugins.qgis.org/plugins/processing_trajectory/version/1.0.2/ Thanks again for reporting!