matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

Coordinates time series output for simulated routes #753

Open 26alo opened 2 years ago

26alo commented 2 years ago

Hello! I'm using MATSIM to simulate freight routes. I wrote a plan for one agent where I only stated a starting point with coordinates Xa and Ya (point A) and a final point with coordinates Xz and Yz (point B). The simulation runs smoothly and the agent navigates from A to B without any issues.

Now, I'm interested in knowing what coordinates the agent navigates through to get from A to B. Is there any way to get the coordinate output for the entire route (from A to B) for a given time resolution (ie. coordinates per each second)? I could not find this in the output file, so I thought that maybe there is an extension for that.

Thank you!

JWJoubert commented 2 years ago

The mobility simulation is link-based, @26alo. So the events.xml.gz that are produced as part of the output will only recall the LinkEnterEvent and the LinkLeaveEvent.

This is different to what you (visually) see in, for example, the Simunto visualiser Via, where it seems the vehicles are moving continuously. Maybe @mrieser can shed some light on how exactly he does it, but Via essentially interpolates the vehicle's position on the link.

I guess you want to reverse engineer a GPS trace from the mobility simulation?

26alo commented 2 years ago

Thanks for the reply @JWJoubert -- exactly, 'reverse engineer a GPS trace' is an accurate way to put it!

aayushtewari01 commented 1 year ago

@26alo I am not sure if this is what you looking for, but thought of sharing if it helps in this context. In output_plan file each agent has set of plans out of which one plan is selected and executed. Or we can also generate the executed plan file through configuration. In this output plan file there are list of routes as link ids that agents negotiate, if you can extract those links and then identify the corresponding linestring or end coordinates of those links (which is available as node coordinates) then we can visualize the agents trajectory. I used same method to visualize few trajectories. It certainly is a static visualization and not the time second representation. Thanks