matsim-org / GTFS2MATSim

A GTFS to MATSim converter, maintained by the Berlin team.
http://matsim.org/extension/gtfs2matsim
Other
12 stars 20 forks source link

Error when try to run RunGTFS2MATSimExample.java #17

Closed jalal1 closed 4 years ago

jalal1 commented 4 years ago

When I try to run RunGTFS2MATSimExample.java, I get the error below.

I read the previous issues related to this error but doesn't work.

2020-05-07 21:50:48,461 WARN MGC:174 Assuming that coordinates are in longitude first notation, i.e. (longitude, latitude). 2020-05-07 21:50:48,772 INFO Logger:? dataFileCache open start 2020-05-07 21:50:48,861 WARN MGC:174 Assuming that coordinates are in longitude first notation, i.e. (longitude, latitude). 978 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table feed_info from feed_info.txt 988 [main] INFO com.conveyal.gtfs.GTFSFeed - Feed ID is undefined, pester maintainers to include a feed ID. Using file name Latest_BJCTA_GTFS_042220. 988 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table agency from agency.txt 990 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table calendar_dates from calendar_dates.txt 1005 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table fare_attributes from fare_attributes.txt 1006 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Table fare_rules was missing but it is not required. 1006 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table routes from routes.txt 1007 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table shapes from shapes.txt 1816 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table stops from stops.txt 1829 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table transfers from transfers.txt 1829 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table trips from trips.txt 1844 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table frequencies from frequencies.txt 1845 [main] INFO com.conveyal.gtfs.model.Entity$Loader - Loading GTFS table stop_times from stop_times.txt 2557 [main] INFO com.conveyal.gtfs.GTFSFeed - 4 errors Feed start date: 2020-05-04 Feed end date: 2030-02-01 2557 [main] INFO com.conveyal.gtfs.GTFSFeed - GTFSError: calendar line 0: This table is required by the GTFS specification but is missing. 2557 [main] INFO com.conveyal.gtfs.GTFSFeed - GTFSError: fare_attributes line 0: Table is present in zip file, but it has no entries. 2557 [main] INFO com.conveyal.gtfs.GTFSFeed - GTFSError: frequencies line 0: Table is present in zip file, but it has no entries. 2557 [main] INFO com.conveyal.gtfs.GTFSFeed - GTFSError: transfers line 0: Table is present in zip file, but it has no entries. Parsed trips: 3678 Parsed routes: 22 Parsed stops: 1363 2020-05-07 21:50:51,638 INFO Config:572 setting context to [file:/C:/Users/Jalal/eclipse-workspace/tranist/GTFS2MATSim-master/] Exception in thread "main" java.lang.NoSuchMethodError: org.geotools.geometry.jts.JTS.transform(Lorg/locationtech/jts/geom/Geometry;Lorg/opengis/referencing/operation/MathTransform;)Lorg/locationtech/jts/geom/Geometry; at org.matsim.core.utils.geometry.transformations.GeotoolsTransformation.transform(GeotoolsTransformation.java:70) at org.matsim.contrib.gtfs.GtfsConverter.convertStops(GtfsConverter.java:125) at org.matsim.contrib.gtfs.GtfsConverter.convert(GtfsConverter.java:55) at org.matsim.contrib.gtfs.RunGTFS2MATSim.convertGtfs(RunGTFS2MATSim.java:45) at org.matsim.contrib.gtfs.RunGTFS2MATSimExample.main(RunGTFS2MATSimExample.java:63)

jalal1 commented 4 years ago

It works when I replaced CoordinateTransformation ct from line below : RunGTFS2MATSim.convertGtfs(gtfsZipFile, scheduleFile, date, ct, false); with : RunGTFS2MATSim.convertGtfs(gtfsZipFile, scheduleFile, date, new IdentityTransformation(), false);

Can someone elaborate more about "CoordinateTransformation" ?

jfbischoff commented 4 years ago

You must specify a Coordinate Transformation to your desired Coordinate System. If you use IdentityTransformation(), nothing will happen and your output will be in WGS84 coordinates. That is usually not be desirable. Typically, MATSim uses some kind of projected Coordinate System. Try something like TransformationFactory.getCoordinateTransformation(TransformationFactory.WGS84,"EPSG:2056"), replacing it the EPSG code of the region you are actually working on.

jalal1 commented 4 years ago

@jfbischoff , Thank you for your reply.

Actually, the original code was :

CoordinateTransformation ct = TransformationFactory.getCoordinateTransformation(TransformationFactory.WGS84, "EPSG:25833"); RunGTFS2MATSim.convertGtfs(gtfsZipFile, scheduleFile, date, ct, false);

But, I am receving the following error, do you have any idea please how to fix ?

2020-05-08 08:17:42,988 INFO Config:572 setting context to [file:/C:/Users/Jalal/eclipse-workspace/tranist/GTFS2MATSim-master/] Exception in thread "main" java.lang.NoSuchMethodError: org.geotools.geometry.jts.JTS.transform(Lorg/locationtech/jts/geom/Geometry;Lorg/opengis/referencing/operation/MathTransform;)Lorg/locationtech/jts/geom/Geometry; at org.matsim.core.utils.geometry.transformations.GeotoolsTransformation.transform(GeotoolsTransformation.java:70) at org.matsim.contrib.gtfs.GtfsConverter.convertStops(GtfsConverter.java:125) at org.matsim.contrib.gtfs.GtfsConverter.convert(GtfsConverter.java:55) at org.matsim.contrib.gtfs.RunGTFS2MATSim.convertGtfs(RunGTFS2MATSim.java:45) at org.matsim.contrib.gtfs.RunGTFS2MATSimExample.main(RunGTFS2MATSimExample.java:65)

jfbischoff commented 4 years ago

This looks like you have a version mismatch somewhere in your setup.

jalal1 commented 4 years ago

I downloaded the repo from github, made a small fix to pom.xml that mentioned here

Then Maven install/build that may installed some mismatch packages. I am using MATSim version 11 with the following java details : java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

What I really need is the Mercator coordinates, so it works when I use : CoordinateTransformation ct = new WGS84toMercator(); where WGS84toMercator is a custom class used to convert lat-lon to UTM.

Note : I am new to java/eclipse package settings and versions, so maybe I missed something :)