Skip to content

Commit

Permalink
Merge branch 'master' into additionalLineInfo
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/matsim/pt2matsim/run/Gtfs2TransitSchedule.java
  • Loading branch information
Tobias Kohl committed Dec 18, 2024
2 parents 51b7684 + 2d895e2 commit f3fb88d
Show file tree
Hide file tree
Showing 87 changed files with 73,969 additions and 742 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
5 changes: 2 additions & 3 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Maven Deploy

on:
release:
types:
- created
types: [created]

jobs:
deploy-release:
Expand All @@ -24,7 +23,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: 'adopt'
server-id: pt2matsim-releases
server-username: MAVEN_USERNAME
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.11
java-version: 1.17
- name: Build with Maven
run: mvn test -B -Dmatsim.preferLocalDtds=true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PT2MATSim

[![Build Status](https://travis-ci.org/matsim-org/pt2matsim.svg?branch=master)](https://travis-ci.org/matsim-org/pt2matsim)
[![Status Maven Test](https://github.com/matsim-org/pt2matsim/actions/workflows/maven-test.yml/badge.svg)](https://github.com/matsim-org/pt2matsim/actions/workflows/maven-test.yml)

PT2MATSim is a package to convert public transit data from GTFS, HAFAS or OSM to a completely mapped MATSim schedule.

Expand Down Expand Up @@ -45,8 +45,8 @@ To include pt2matsim in your own maven project, add this snippet to your pom.xml
<dependency>
<groupId>org.matsim</groupId>
<artifactId>pt2matsim</artifactId>
<version>22.3</version>
<version>24.4</version>
</dependency>
</dependencies>

The master branch contains the snapshot version with the latest changes. Clone the git repository to use it.
The master branch contains the snapshot version with the latest changes. Clone the git repository to use it.
2 changes: 2 additions & 0 deletions doc/defaultOsmConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
This file can be used for visualization purposes in Simunto Via or GIS software. -->
<param name="outputDetailedLinkGeometryFile" value="null" />
<param name="outputNetworkFile" value="null" />
<!-- If true: OSM turn restrictions are parsed and written as disallowedNextLinks attribute to the first link. -->
<param name="parseTurnRestrictions" value="false" />
<!-- In case the speed limit allowed does not represent the speed a vehicle can actually realize,
e.g. by constrains of traffic lights not explicitly modeled, a kind of "average simulated speed" can be used.
Defaults to false. Set true to scale the speed limit down by the value specified by the wayDefaultParams) -->
Expand Down
133 changes: 91 additions & 42 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.matsim</groupId>
<artifactId>pt2matsim</artifactId>
<version>22.3</version>
<version>24.5-SNAPSHOT</version>

<name>PT2MATSim</name>
<description>Public Transport to MATSim</description>

<distributionManagement>
<repository>
<id>pt2matsim-releases</id>
<name>pt2matsim Releases Maven Repository</name>
<url>https://repo.matsim.org/repository/matsim-releases/</url>
</repository>
<id>pt2matsim-releases</id>
<name>pt2matsim Releases Maven Repository</name>
<url>https://repo.matsim.org/repository/matsim-releases/</url>
</repository>
</distributionManagement>

<repositories>
Expand All @@ -23,70 +23,118 @@
<url>https://repo.matsim.org/repository/matsim</url>
</repository>
<repository>
<id>osgeo</id>
<url>https://repo.osgeo.org/repository/release</url>
<id>osgeo</id>
<url>https://repo.osgeo.org/repository/release</url>
</repository>
</repositories>

<properties>
<geotools.version>24.2</geotools.version>
</properties>
<properties>
<geotools.version>29.6</geotools.version>
<jackson.version>2.18.2</jackson.version>
<jts.version>1.19.0</jts.version>
<log4j.version>2.23.1</log4j.version>
<junit.version>5.10.3</junit.version>
</properties>

<dependencies>
<dependency>
<groupId>org.matsim</groupId>
<artifactId>matsim</artifactId>
<version>13.0</version>
<version>2024.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>3.7</version>
<version>5.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>de.grundid.opendatalab</groupId>
<artifactId>geojson-jackson</artifactId>
<version>1.5</version>
<version>1.14</version>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.9.1</version>
<version>2.11.5</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.3.1-jre</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<!-- required for tests with geojson-jackson -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>${jts.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<artifactId>gt-opengis</artifactId>
<version>${geotools.version}</version>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>false</showWarnings>
<showDeprecation>false</showDeprecation>
<release>17</release>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<encoding>UTF-8</encoding>
<!-- configure initial and maximal memory for compiling -->
<fork>true</fork>
Expand All @@ -101,14 +149,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.6.0</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
Expand All @@ -117,24 +166,24 @@
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import org.matsim.core.api.internal.MatsimParameters;
import org.matsim.core.config.*;
import org.matsim.core.config.ReflectiveConfigGroup.Comment;
import org.matsim.core.config.ReflectiveConfigGroup.Parameter;
import org.matsim.core.utils.collections.CollectionUtils;
import org.matsim.pt2matsim.osm.lib.Osm;

Expand Down Expand Up @@ -65,6 +67,9 @@ public class OsmConverterConfigGroup extends ReflectiveConfigGroup {
private boolean keepTagsAsAttributes = true;
private boolean keepWaysWithPublicTransit = true;

@Parameter
@Comment("If true: OSM turn restrictions are parsed and written as disallowedNextLinks attribute to the first link.")
public boolean parseTurnRestrictions = false;

public OsmConverterConfigGroup() {
super(GROUP_NAME);
Expand Down Expand Up @@ -254,7 +259,7 @@ public ConfigGroup createParameterSet(final String type) {
*/
public static class OsmWayParams extends ReflectiveConfigGroup implements MatsimParameters {

public final static String SET_NAME = "wayDefaultParams";
public static final String SET_NAME = "wayDefaultParams";

private String osmKey;
private String osmValue;
Expand Down Expand Up @@ -385,7 +390,7 @@ private void setAllowedTransportModesString(String allowedTransportModesString)
*/
public static class RoutableSubnetworkParams extends ReflectiveConfigGroup implements MatsimParameters {

public final static String SET_NAME = "routableSubnetwork";
public static final String SET_NAME = "routableSubnetwork";

/** Network mode, for which a consistent routable network is created **/
private String subnetworkMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public void setCandidateDistanceMultiplier(double multiplier) {
*/
public static class TransportModeAssignment extends ReflectiveConfigGroup implements MatsimParameters {

public final static String SET_NAME = "transportModeAssignment";
public static final String SET_NAME = "transportModeAssignment";

private static final String SCHEDULE_MODE = "scheduleMode";
private static final String NETWORK_MODES = "networkModes";
Expand Down
30 changes: 20 additions & 10 deletions src/main/java/org/matsim/pt2matsim/editor/BasicScheduleEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@

package org.matsim.pt2matsim.editor;

import com.opencsv.CSVParserBuilder;
import com.opencsv.CSVReader;
import org.apache.log4j.Logger;
import com.opencsv.CSVReaderBuilder;
import com.opencsv.exceptions.CsvValidationException;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.matsim.api.core.v01.Coord;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.network.Link;
Expand Down Expand Up @@ -50,7 +55,7 @@
*/
public class BasicScheduleEditor implements ScheduleEditor {

protected static Logger log = Logger.getLogger(RunScheduleEditor.class);
protected static Logger log = LogManager.getLogger(RunScheduleEditor.class);
// fields
private final Network network;
private final TransitSchedule schedule;
Expand Down Expand Up @@ -93,15 +98,20 @@ public TransitSchedule getSchedule() {
*/
@Override
public void parseCommandCsv(String filePath) throws IOException {
CSVReader reader = new CSVReader(new FileReader(filePath), ';');

String[] line = reader.readNext();
while(line != null) {
log.info(CollectionUtils.arrayToString(line));
executeCmdLine(line);
line = reader.readNext();
try (CSVReader reader = new CSVReaderBuilder(new FileReader(filePath))
.withCSVParser(new CSVParserBuilder()
.withSeparator(';')
.build())
.build()) {
String[] line = reader.readNext();
while (line != null) {
log.info(CollectionUtils.arrayToString(line));
executeCmdLine(line);
line = reader.readNext();
}
} catch (CsvValidationException e) {
throw new RuntimeException(e);
}
reader.close();
}

/**
Expand Down
Loading

0 comments on commit f3fb88d

Please sign in to comment.