eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.46k stars 1.39k forks source link

About drawing a vehicle trajectory diagram #15192

Open xql5891129 opened 1 month ago

xql5891129 commented 1 month ago

Add your issue description here.

If possible, upload an example that shows your problem. I now have some GPS data for the bus, which contains the route number, latitude and longitude of the bus. I found that the road network exported by osmWebWizard has latitude and longitude information. Is there any way to draw a trajectory map in the road network based on the GPS information of the bus?I want to see which intersections the bus has passed. thank you! SUMO-version: 1.20 operating system: Windows11

m-kro commented 1 month ago

You could convert your input data to SUMO polygon format using polyconvert and load it in your network as an additional file. Probably you have to use an intermediate format like shapefile or navteq to get it working.

namdre commented 1 month ago

see also https://sumo.dlr.de/docs/Geo-Coordinates.html

xql5891129 commented 1 month ago

see also https://sumo.dlr.de/docs/Geo-Coordinates.html

I use “net.getNeighboringEdges(x,y)” to find the edge closest to my latitude and longitude coordinates, but the return value is always empty

namdre commented 1 month ago

call net.convertLonLat2XY first to get x,y coordinates for getNeighboringEdges.

xql5891129 commented 1 month ago

首先调用 net.convertLonLat2XY 以获取 getNeighboringEdges 的 x,y 坐标。

Thanks, I found the reason, I should turn up the argument “r” in function “getNeighboringEdges” a bit more

xql5891129 commented 1 month ago

I can now use the function getNeighboringEdges to get the road IDs by combining the latitude and longitude coordinates of the bus, but I have a problem merging these road IDs into a route. I need to determine if there is a connection between the two road IDs, is there such a function

namdre commented 1 month ago

https://sumo.dlr.de/docs/Tools/Routes.html#tracemapperpy

xql5891129 commented 1 month ago

https://sumo.dlr.de/docs/Tools/Routes.html#tracemapperpy

Thank you for your help, but when I use tool ‘tracemapper.py’, I generate a route file with some edges that are not connected.Is there any way to fix it image

namdre commented 1 month ago

run with with option --fill-gaps (set the maximum possible gap size you wish to close).

xql5891129 commented 1 month ago

But no matter how I tweak ‘--fill-gaps’ , there is nothing in the generated rou file

namdre commented 1 month ago

Can you share your inputs? And maybe @behrisch has more indeas on this?

xql5891129 commented 1 month ago

Can you share your inputs? And maybe @behrisch has more indeas on this? The ‘tracemapper.py’ is in my python file ‘csv2rou.py’, and '506_2023-01-01.csv' is the GPS data of my bus.Thank you for your help caijia.zip

namdre commented 1 month ago

The data is too noisy to for mapping to the correct edge and possibly the network geometry is inaccurate in some places as well. As a further problem the density of points in time is either very low or the data points are in the wrong order. The screenshots shows some data points along with their index of occurrence. As you can see there are hug jumps in index which either means the trace contains many loops and is also sparse or the points are out of order.

Screenshot from 2024-07-16 14-11-58