matsim-org/matsim-code-examples

Route through resticted/private roads

subrina0013 opened this issue · 3 comments

I have some routes that goes through restricted or private roads. So, I guess MATSim doesn't care about restriction on a road unless one way lanes? How to change that and let matsim consider restrictions of roads so that it doesn't end up taking roads that are not accessible?

This can be modelled in several ways.

If you want to restrict roads for certain modes of transportations, for example, you want to have car-free roads, you can adjust the allowedModes property of those links, i.e. remove the car mode from the allowedModes on those links. This way the router will not consider these links for newly generated routes.

If you want to restrict traffic on certain links entirely, you can also decrease the freespeed and/or the capacity of those links to a very low value. Agents will try to use these links, but will receive low scores for such routes, since it will increase travel times.

It is always possible to adjust the routing as well, and implement a custom filter. This requires substantial knowledge of Java-programming and the MATSim framework though.

Thank you. I think modifying the network file is a good option.
However, when matsim parse the osm tags, can't it also consider restriction on a road?

You can have a look into our network reader examples. The reader assignes the mode car to all links by default. If you want to do something else, your best option is to hook into setAfterLinkCreated and set allowed modes there.

If you already have a network and want to set those restrictions, working with the matsim data format is probably the way to go.