Open SarahSie opened 4 years ago
The name in the transitSchedule.xml is mostly for informative purposes, e.g. to show the name in a visualizer or while debugging. Internally, MATSim only uses the id for lookups. There is no lookup to get a stop given its name, except to iterate over all stops and test if a name matches.
Similarly, MATSim only uses link ids and node ids in the network, and does not even provide a name. A link could represent a segment of a street only in detailed networks, or could actually represent multiple streets in a coarse network, so a single name might not even be suitable in all cases.
If you want to add names to links or nodes, you can use custom attributes to do so:
Link link = ....;
link.getAttributes().putAttribute("name", "2nd Street");
But also in this case, you would have to write custom logic to find a link given it's name, and you would have to deal with the simulation that more than one link can have the same name.
@mrieser Thank you for your answer. I want to make a disruption for a particular road in my network. However, I don’t know which "link id" refers to the one that I am looking for. Then how can I find the link id for a particular road?
The best way to figure out what link id a real-world road has is to visualize the network, e.g. with OTFVis, the JOSM plugin, or with Via (https://www.simunto.com/via/). Some of the tools allow you to show a map in the background, while others only show the raw network.
Or if you know the coordinates of the link, you could search for the coordinates.
Depending on how you created the network: Some converters that use OSM data use the original OSM node ids for MATSim node ids. So you could also try to figure out the OSM node ids and then use those ids for a lookup in MATSim, but that really depends on the converter and how much the network is simplified.
Then I will search with Via, thank you for your response.
Hello all,
The schedule.xml includes both stopFacility id and name. However, network.xml does not include any name. For car simulation, how can I find the "link id" corresponds to a street on the map? Or the related "node id" based on the location?