-
Notifications
You must be signed in to change notification settings - Fork 179
faq 107833826
by Karsten Hager on 2017-02-13 10:21:46
I am using the https://github.com/matsim-org/matsim/blob/master/playgrounds/agarwalamit/src/main/java/playground/agarwalamit/utils/networkProcessing/ShapeFileToNetworkDelhi.java script as a reference for the conversion of my network which is in .shp format. First of all I have to say, this works surprisingly well despite reading several topics and questions concerning the difficulties when converting networkfiles from .shp to .xml. I couldnt test the functionality of the network in a simulation yet though, because its the first step for building my Stuttgart model, which is including Public Transport.
The script is using the NetworkUtils.createAndAddLink method, which calls several parameters:
Network network, final Id<Link> id, final Node fromNode, final Node toNode, final double length, final double freespeed,
final double capacity, final double numLanes, final String origId, final String type
I wonder why there is no possibility to call something like a String mode for adding the several traffic modes to the links? Even though there is no argument for the modes, my resulting network from the script has on all links modes="car", which seems to be the default value. I have the information for the modes on the network links and plan to use them as well.
My questions are now:
- Is it possible to add the modes to the NetworkUtils.createAndAddLink method (in case I'm missing something)?
- or would I need to find a different way to convert the network?
Thanks for any kind of advice!
by Joschka Bischoff on 2017-02-13 10:41:21
Dear Karsten,
NetworkUtils.createAndAddLink()
returns the link as object, so you can set the modes easily.
Set<String> modes = new HashSet<>();
modes.add("car");
modes.add("pt");
Link l = NetworkUtils.createAndAddLink(network, id, fromNode, toNode, length, freespeed, capacity, numLanes, origId, type) ;
l.setAllowedModes(modes);
Hope this helps,
Joschka
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq