Skip to content

Commit

Permalink
improvements for pt schedule generation
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Oct 23, 2024
1 parent 7a8ee0f commit ee79c44
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file.
- The weight is based on an attraction factor and zone specific probabilities determined from survey data
- Update GTFS schedule
- TODO
- New dashboard
- PT Transit viewer

### 6.3 (2024-07)
- Include additional trip analysis and updated dashboard
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ $p/berlin-$V-network.xml.gz: input/sumo.net.xml

$p/berlin-$V-network-with-pt.xml.gz: $p/berlin-$V-network.xml.gz
$(sc) prepare transit-from-gtfs --network $< --output=$p\
--name berlin-$V --date "2024-11-19" --target-crs $(CRS) \
$(germany)/gtfs/complete-pt-2024-10-14.zip\ # TODO waiting for update
--name berlin-$V --date "2024-11-18" --target-crs $(CRS) \
$(germany)/gtfs/complete-pt-2024-10-21.zip\
--copy-late-early\
--transform-stops org.matsim.prepare.pt.CorrectStopLocations\
--transform-routes org.matsim.prepare.pt.CorrectRouteTypes\
--transform-schedule org.matsim.application.prepare.pt.AdjustSameDepartureTimes\
--shp $p/pt-area/pt-area.shp

$p/berlin-$V-counts-vmz.xml.gz: $p/berlin-$V-network.xml.gz
Expand Down Expand Up @@ -295,7 +298,8 @@ $p/berlin-$V-25pct.plans-initial.xml.gz: $p/berlin-$V-facilities.xml.gz $p/berli
--output-population $@\
--output-network $p/network-cutout.xml.gz\
--output-facilities $p/facilities-cutout.xml.gz\
--shp input/$V/area/area.shp\
--input-crs $(CRS)\
--shp input/$V/area/area.shp

$(sc) prepare split-activity-types-duration\
--exclude commercial_start,commercial_end,freight_start,freight_end\
Expand Down
1 change: 1 addition & 0 deletions input/v6.4/area/area.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file modified input/v6.4/area/area.dbf
Binary file not shown.
13 changes: 0 additions & 13 deletions input/v6.4/area/area.poly

This file was deleted.

2 changes: 1 addition & 1 deletion input/v6.4/area/area.prj
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
PROJCS["ETRS_1989_UTM_Zone_32N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
27 changes: 27 additions & 0 deletions input/v6.4/area/area.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="3.38.2-Grenoble">
<identifier></identifier>
<parentidentifier></parentidentifier>
<language></language>
<type></type>
<title></title>
<abstract></abstract>
<links/>
<dates/>
<fees></fees>
<encoding></encoding>
<crs>
<spatialrefsys nativeFormat="Wkt">
<wkt></wkt>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</crs>
<extent/>
</qgis>
Binary file modified input/v6.4/area/area.shp
Binary file not shown.
Binary file modified input/v6.4/area/area.shx
Binary file not shown.
2 changes: 2 additions & 0 deletions input/v6.4/berlin-v6.4-vehicleTypes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<!-- 15 kmh -->
<maximumVelocity meterPerSecond="4.16"/>
<passengerCarEquivalents pce="0.2"/>
<networkMode networkMode="bike"/>
</vehicleType>

<vehicleType id="ride">
Expand All @@ -36,6 +37,7 @@
<length meter="7.5"/>
<width meter="1.0"/>
<passengerCarEquivalents pce="1.0"/>
<networkMode networkMode="car"/>
</vehicleType>

<vehicleType id="freight">
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>matsim-all</artifactId>

<!-- PR-labelled release -->
<version>2025.0-PR3512</version>
<version>2025.0-PR3524</version>

<!-- snapshot == not recommended: rather use PR-labelled release!-->
<!-- <version>2025.0-SNAPSHOT</version>-->
Expand Down Expand Up @@ -128,7 +128,7 @@
<dependency>
<groupId>com.github.matsim-org</groupId>
<artifactId>gtfs2matsim</artifactId>
<version>fc8b13954d</version>
<version>0bd5850fd6</version>
<exclusions>
<exclusion>
<groupId>org.matsim</groupId>
Expand Down
47 changes: 47 additions & 0 deletions src/main/java/org/matsim/prepare/pt/CorrectRouteTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.matsim.prepare.pt;

import com.conveyal.gtfs.model.Route;

import java.util.function.Consumer;
import java.util.regex.Pattern;

/**
* Apply better tags to the route types to have more differentiated vehicle types.
*/
@SuppressWarnings("unused")
public class CorrectRouteTypes implements Consumer<Route> {

private static final Pattern ICE = Pattern.compile("ICE [0-9]+");
private static final Pattern IC = Pattern.compile("(IC|EC) [0-9]+");
private static final Pattern RE = Pattern.compile("((RE|RB[0-9]+)|FEX|^RE)");

private static final Pattern S_BAHN = Pattern.compile("S[0-9]+");
private static final Pattern U_BAHN = Pattern.compile("U[0-9]+");

@Override
public void accept(Route route) {
// Check for name and the initial simple route type
if (S_BAHN.matcher(route.route_short_name).matches() && route.route_type == 2) {
route.route_type = 109;
} else if (U_BAHN.matcher(route.route_short_name).matches() && route.route_type == 1) {
route.route_type = 402;
}

// 101 ICE
if (ICE.matcher(route.route_short_name).matches() && route.route_type == 2) {
route.route_type = 101;
}

// 102 InterCity/EuroCity
if (IC.matcher(route.route_short_name).matches() && route.route_type == 2) {
route.route_type = 102;
}

// 106 Regionalzug
if (RE.matcher(route.route_short_name).matches() && route.route_type == 2) {
route.route_type = 106;
}

}

}
29 changes: 29 additions & 0 deletions src/main/java/org/matsim/prepare/pt/CorrectStopLocations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.matsim.prepare.pt;

import com.conveyal.gtfs.model.Stop;

import java.util.function.Consumer;

/**
* Correct stops that are wrong in the input data.
*/
@SuppressWarnings("unused")
public class CorrectStopLocations implements Consumer<Stop> {

@Override
public void accept(Stop stop) {

// Harpe, Ort
if (stop.stop_id.equals("240019")) {
stop.stop_lat = 52.8519613;
stop.stop_lon = 10.8828626;
}

// Quastenberger Damm
if (stop.stop_id.equals("490866")) {
stop.stop_lat = 53.4978109;
stop.stop_lon = 13.3297704;
}
}

}

0 comments on commit ee79c44

Please sign in to comment.