-
Notifications
You must be signed in to change notification settings - Fork 180
faq 111778802
by Jinkai Zhou on 2017-09-06 18:33:06
How the MATSim sets the link freespeed in the network file?
In my scenario, I created a New York City network file from the OSM. However the link freespeed are way too high. Is fast way to change the freespeed other than doing it manually?
by Johan W. Joubert on 2017-09-06 18:44:43
There is a template/default value for different OSM link types. If you want to adapt it, you can apply your own defaults. I thought there might be an example I can point you to, but I cannot find it right now. What you need is something like the following:
Scenario sc = (MutableScenario) ScenarioUtils.createScenario( ConfigUtils.createConfig() );
Network nw = sc.getNetwork();
CoordinateTransformation ct = TransformationFactory.getCoordinateTransformation(TransformationFactory.WGS84, CRS); // Where CRS is your own projected coordinate reference system.
OsmNetworkReader onr = new OsmNetworkReader(nw, ct, true);
onr.setKeepPaths(fullNetwork);
/*
* Configure the highway classification.
*/
LOG.info("Overwriting some highway defaults...");
onr.setHighwayDefaults(1, "trunk", 1, 120/3.6, 1, 2000);
onr.setHighwayDefaults(1, "primary", 2, 80/3.6, 1, 1500);
onr.setHighwayDefaults(1, "secondary", 2, 80/3.6, 1, 1000);
/* ... and whatever else you want to set ... */
LOG.info("Parsing the OSM file...");
onr.parse(inputFile);
by Dominik Ziemke on 2017-09-06 18:53:49
Dear Jinkai,
you have probably used code that calls the
OSMNetworkReader
for this task?
You can set defaults there via the method
setHighwayDefaults
There, you can specifiy speeds (and other settings) for different road types. However, these defaults are only used when the OSM way that is converted into the link in MATSim does not carry its own "maxspeed" tag on OSM.
If I am not mistaken, you (being in the U.S.) might run into problem if information is tagged in "mph" on OSM (in contrast to the default, which is in km/h). But this should rather lead to too low speeds.
Could you maybe check a few links for their speed tags on OSM and tell me what they were converted to in your MATSim network?
Regards,
Dominik
by Joschka Bischoff on 2017-09-06 19:24:25
If you really just want to change the capacity in an existing network, here is an example script that does just that (now also part of the matsim tutorial code):
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq