Closed almenea closed 5 years ago
@Almenea I also encountered the same problem. It will check it and reply to you later.
Hi, Almenea
I found the cause of this problem. The node id in the shapefile generated by osmnx is too big (as you can see in your warning with maximum node id of 2039118004), which exceeds the range of an integer type after multiplied with nhash. Therefore, it causes problem in freeing the UBODT.
To avoid that problem, one way is to assign a new id to each node.
nodes.shp
file using the feature index, which constrains the range to be within 60,000 (varying with the number of nodes). edges.shp
file with the new node file to add two extra columns fid
and tid
which replaces the old from
and to
column with a much smaller integer value.ubodt_gen
and fmm
. After limiting the range of node ID, the result still shows that 0 points are matched. I think it is caused by some complicated network infrastructure. I will check later.
Besides, the network you generated is too small to cover the trajectory as shown below. You should try 15000 instead of 10000.
The problem of no points matched to the road network is caused by a specific noise (move back behavior) in the GPS data, which cannot be handled correctly by the current algorithm.
Moving in a reverse direction on a single directional road edge is not allowed by the program but it exists in your data due to noise as shown below.
I tried to remove these noise by simplying the trajectory using Douglas Peucker Algorithm (10meter), to generate a sparser trajectory containing 18 points (orange color below). I also increased the size of UBODT to 0.03 (=3000m). Now the trajectory can be successfully matched. (blue color is the map matched trajectory)
If you do not increase the delta of UBODT, the trajectory may still be unmatched because some points are far away (more than 2 km) after simplication. More advanced line simplication algorithm should be tried here to keep the trajectory dense and remove some noisy observations.
Yes, you are right. The trajectory falls outside the map. I tried to use Ramer-Douglas-Peucker algorithm to simplify the trajectory and fmm started working as expected. Thank you for your efforts.
I tried to run fmm with city scale graph and one gps trajectory. I ended up with memory corruption.
I generated the network using osmnx:
GPS as WKT (generated using GeoPandas):