Skip to content

Commit

Permalink
make sure mode filtered network is handed over to DrtStopsWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Sep 5, 2022
1 parent e7a4db3 commit 6d54cb6
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.locationtech.jts.geom.Geometry;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.network.Node;
import org.matsim.application.MATSimAppCommand;
Expand Down Expand Up @@ -81,6 +83,12 @@ public Integer call() throws Exception {
TransportModeNetworkFilter filter = new TransportModeNetworkFilter(network);
filter.filter(filteredNetwork, modes);

//still car has to be re-added for further usage
modes.add(TransportMode.car);
for(Link link : filteredNetwork.getLinks().values()) {
link.setAllowedModes(modes);
}

network = filteredNetwork;

log.info("Using a network filtered by mode " + mode + ". " +
Expand Down Expand Up @@ -120,7 +128,10 @@ public Integer call() throws Exception {
csvWriter.close();

MATSimAppCommand prepareDrtStops = new PrepareDrtStops();
prepareDrtStops.execute("--stops-data", stopsData, "--network", config.network().getInputFile(), "--mode", mode,
String outputNet = outputFolder + "/networkForDrtStopCreation.xml.gz";
NetworkUtils.writeNetwork(network, outputNet);
Network compare = NetworkUtils.readNetwork(outputNet);
prepareDrtStops.execute("--stops-data", stopsData, "--network", outputNet, "--mode", mode,
"--shp", shp.getShapeFile().toString(), "--output-folder", outputFolder);

return 0;
Expand Down

0 comments on commit 6d54cb6

Please sign in to comment.