Skip to content

Commit

Permalink
Merge pull request #26 from matsim-scenarios/tagTransitStops
Browse files Browse the repository at this point in the history
Tag transit stops served by certain mode
  • Loading branch information
rakow authored May 22, 2024
2 parents 35cfe22 + 0fef78e commit b13a5bc
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 213 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ For more information about traffic simulation and traffic data at the Regionalve
Some functionality in this repository is based on the 'MATSim Open Ruhrgebiet' model (https://github.com/matsim-scenarios/matsim-ruhrgebiet) where the development was made possible by Stiftung Mercator (https://www.stiftung-mercator.de/) within the project Neue Emscher Mobilität (NEMO, https://www.nemo-ruhr.de).

The travel demand data for the metropolitan area Ruhr is provided by Senozon Deutschland GmbH (https://senozon.com).

### Internal documentation

Internal documentation can be found here:
https://docs.google.com/document/d/1GQhdJh4Cg4ZrzbcP_aB4KYK6jxIGmj5EB1eyIbWNbAU/edit?usp=sharing
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.matsim</groupId>
<artifactId>matsim-all</artifactId>
<version>2025.0-PR3273</version>
<version>2025.0-PR3278</version>
<!-- <version>16.0-SNAPSHOT</version>-->
</parent>

Expand Down Expand Up @@ -142,7 +142,7 @@
<dependency>
<groupId>com.github.matsim-org</groupId>
<artifactId>gtfs2matsim</artifactId>
<version>master-33809c4f0f-1</version>
<version>fc8b13954d</version>
<exclusions>
<exclusion>
<groupId>org.matsim</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/analysis/Person2Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.gis.ShapeFileReader;
import org.opengis.feature.simple.SimpleFeature;
import org.geotools.api.feature.simple.SimpleFeature;
import picocli.CommandLine;

import java.io.FileWriter;
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/org/matsim/prepare/CreateSupply.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.matsim.prepare.counts.LongTermCountsCreator;
import org.matsim.prepare.counts.RawDataVehicleTypes;
import org.matsim.prepare.counts.ShortTermCountsCreator;
import org.opengis.feature.simple.SimpleFeature;
import org.geotools.api.feature.simple.SimpleFeature;

import java.io.FileReader;
import java.io.IOException;
Expand Down Expand Up @@ -287,14 +287,23 @@ private void run(Path rootDirectory) {

// --------------------------------------- Create Pt -----------------------------------------------------------

String outputName = "metropole-ruhr-v2.0";
new CreateTransitScheduleFromGtfs().execute(
rootDirectory.resolve(gtfsData1).toString(), rootDirectory.resolve(gtfsData2).toString(),
"--date", gtfsDataDate1, gtfsDataDate2,
"--prefix", gtfsData1Prefix + "," + gtfsData2Prefix + "," + gtfsData2Prefix,
"--target-crs", "EPSG:25832",
"--network", networkOut,
"--output", outputDir.toString(),
"--name", "metropole-ruhr-v2.0"
"--name", outputName
);

// --------------------------------------------------------------------

new TagTransitSchedule().execute(
"--input", outputDir + "/" + outputName + "-transitSchedule.xml.gz",
"--shp", ruhrShape.toString(),
"--output", outputDir + "/" + outputName + "-transitSchedule.xml.gz"
);

// --------------------------------------- Create Counts -------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/matsim/prepare/ElevationReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geotools.api.referencing.operation.TransformException;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.geotools.geometry.DirectPosition2D;
import org.geotools.geometry.Position2D;
import org.matsim.api.core.v01.Coord;
import org.matsim.core.utils.geometry.CoordinateTransformation;
import org.opengis.referencing.operation.TransformException;

import java.awt.image.Raster;
import java.io.File;
Expand All @@ -33,7 +33,7 @@ public class ElevationReader {
public double getElevationAt(Coord coord) {

Coord transformed = transformation.transform(coord);
var position = new DirectPosition2D(transformed.getX(), transformed.getY());
var position = new Position2D(transformed.getX(), transformed.getY());

for (ElevationMap elevationMap : elevationMaps) {

Expand Down Expand Up @@ -67,11 +67,11 @@ private static class ElevationMap {
}
}

boolean covers(DirectPosition2D position) {
boolean covers(Position2D position) {
return coverage.getEnvelope2D().contains(position.getX(), position.getY());
}

double getElevation(DirectPosition2D position) {
double getElevation(Position2D position) {

if (!coverage.getEnvelope2D().contains(position.getX(), position.getY())) {
throw new IllegalArgumentException("position is not covered by height map. Test with 'covers' first");
Expand Down
Loading

0 comments on commit b13a5bc

Please sign in to comment.