gabboxl / gtfs-osm-import Goto Github PK
View Code? Open in Web Editor NEWA Java tool to import/sync GTFS data into OSM
License: GNU General Public License v3.0
A Java tool to import/sync GTFS data into OSM
License: GNU General Public License v3.0
Had a look at the output result imported into OsmAnd for a route which is not implemented in OSM - spin-off topic, but it gives an assessment of the proposed routing for public transport from GTFS only:
General view: I encircled 3 strange routing points - resulting in failures on the proposed routing.
The routes from the operator are as follows:
Analysis:
To be expected, as this is a route which is not in OSM, and therefore the specific ways on the problematic points are not adjusted in OSM.
Conclusion: nice experiment but it is not possible to do a nice perfect routing on the map with the data only coming from GTFS. For the public transport routes which are not in OSM the offline map through OsmAnd will do give the stops but the visual routing will be limited. But still impressed what is possible.
Hi,
I think the relation member roles "platform_exit_only" and "platform_entry_only" for buses (but I have seen this also for ferries) and "stop_exit_only" and "stop_entry_only" should be added - ref, PTv2 - I get warning like:
Warning: Relation 5474612 has a member node with an unsupported role "platform_entry_only", node ref/Id = 3729055350
Warning: Relation 5474612 has a member node with an unsupported role "platform_exit_only", node ref/Id = 8255207189
Warning: Relation 5474612 has a member node with an unsupported role "stop_exit_only", node ref/Id = 8255207188
Warning: Relation 5474612 has a member node with an unsupported role "stop_entry_only", node ref/Id = 3150475960
Warning: Relation 5474641 has a member node with an unsupported role "stop_exit_only", node ref/Id = 3729120340
Warning: Relation 5474641 has a member node with an unsupported role "platform_entry_only", node ref/Id = 3729119504
Warning: Relation 5474641 has a member node with an unsupported role "stop_entry_only", node ref/Id = 3729120336
Warning: Relation 5474641 has a member node with an unsupported role "platform_entry_only", node ref/Id = 3729119511
Warning: Relation 5474641 has a member node with an unsupported role "stop_entry_only", node ref/Id = 4322954831
Warning: Relation 5474641 has a member node with an unsupported role "platform_exit_only", node ref/Id = 3729119498
As far as I can see the check is in OSMParser.java on line 431:
if (tempMemberRole.equals("stop") || tempMemberRole.equals("platform")) {
OSMStop osmStop = stopsWithOSMIndex.get(tempMemberRef);
Hi,
Still on the same gtfs file (Tursib). stops works fine, but reldiff/reldiffx (using the interactivedebug) crashes at the end of the file. The fullrels CLI option closes normally.
reldiff/reldiffx:
Warning: Relation 5481564 has a member node with an unsupported role "stop_entry_only", node ref/Id = 8257724560
Warning: Relation 5481564 has a member node with an unsupported role "platform_entry_only", node ref/Id = 8257724559
Warning: Relation 5483029 has a member (id: 5481563) of an unsupported type "relation"
Warning: Relation 5483029 has a member (id: 5481564) of an unsupported type "relation"
Skipping OSM relation 5483029 as its type tag (S.C.Tursib S.A) is not a route.
Warning: Relation 5515258 has a member (id: 5481563) of an unsupported type "relation"
Warning: Relation 5515258 has a member (id: 5481564) of an unsupported type "relation"
Skipping OSM relation 5515258 as its type tag (null) is not a route.
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 9
at it.osm.gtfs.input.GTFSParser.readRoutes(GTFSParser.java:245)
at it.osm.gtfs.commands.gui.GTFSRouteDiffGui.readData(GTFSRouteDiffGui.java:102)
at it.osm.gtfs.commands.gui.GTFSRouteDiffGui.(GTFSRouteDiffGui.java:50)
at it.osm.gtfs.commands.CmdRelDiffGui.call(CmdRelDiffGui.java:32)
at it.osm.gtfs.commands.CmdRelDiffGui.call(CmdRelDiffGui.java:26)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at picocli.shell.jline3.PicocliCommands.invoke(PicocliCommands.java:283)
at org.jline.console.impl.SystemRegistryImpl.execute(SystemRegistryImpl.java:1228)
at org.jline.console.impl.SystemRegistryImpl.execute(SystemRegistryImpl.java:1273)
at it.osm.gtfs.GTFSOSMImport.interactive(GTFSOSMImport.java:176)
at it.osm.gtfs.GTFSOSMImport.main(GTFSOSMImport.java:202)
The relation 5515258 in this case is the last one in the downloaded relations.osm file (/home/koenvh/gtfs-osm-import/cache).
For the fullrels CLI option closes "normally":
The relations generation will not continue as there are no OSM stops with a GTFS id on OpenStreetMap!
Please run the "stops" command and upload the new stops to OSM first!
Strange because the code in CmdGenerateRoutesFullRelations.java constructs gtfsIdOsmStopMap (osm stops) which shouldn't empty as the stops.osm file is not empty. Still looking for that "This tool generates relations without checking if there are existing ones on OSM at the moment." (which should be based on GTFS only not?) :)
Hi,
It would be nice to have to be able to force the stop matching GUI to always on for debugging purposes. Something like the interactivedebug mode or an option inside.
KR
Koen
Hi,
I got some GTFS files which appear to be encoded in utf-8 with BOM. This cause gtfs-osm-import.jar to crash early :
$ java -jar ~/Téléchargements/gtfs-osm-import.jar stops
Loading config properties...
Config properties loaded successfully.
Welcome to GTFS-OSM-Import!
Downloading and extracting GTFS data from file:///home/laurent/Documents/GTFS/CAPI.GTFS.zip ...
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 6
at it.osm.gtfs.input.GTFSParser.readStops(GTFSParser.java:92)
at it.osm.gtfs.commands.CmdUpdateGTFSOSMData.updateBusStops(CmdUpdateGTFSOSMData.java:76)
at it.osm.gtfs.commands.CmdUpdateGTFSOSMData.call(CmdUpdateGTFSOSMData.java:59)
Beginning of GTFS files looks like this :
$ head -1 gtfsimport/cache/gtfsdata/stops.txt | od -bc
0000000 357 273 277 163 164 157 160 137 151 144 054 163 164 157 160 137
357 273 277 s t o p _ i d , s t o p _
0000020 143 157 144 145 054 163 164 157 160 137 156 141 155 145 054 163
c o d e , s t o p _ n a m e , s
Thus , the first header field is read as "<feff>stop_id",
it fails string match with "stop_id" in GTFSParser.java#L60 , stopIdKey is left with value -1,
and gtfs-osm-import crash later with out-of-bounds array access error GTFSParser.java#L92.
Workaround: edit all GTFS to remove BOM character : vi -c ":set nobomb" -c ":wq" stops.txt
and rebuild GTFS zip file.
Expected fix : sanitize input files from BOM character.
Hi,
Trying this out with this GTFS, with the DefaultPlugin selected in the configuration file (gtfs-import.properties), and launching java -Xms512m -Xmx1g -jar gtfs-osm-import.jar stops
leads to:
Loading config properties...
Config properties loaded successfully.
Welcome to GTFS-OSM-Import!
Downloading and extracting GTFS data from https://tursib.ro/documents/gtfs/tursib.gtfs_2023-06-v1.zip ...
java.lang.NullPointerException: Cannot invoke "it.osm.gtfs.enums.OSMStopType.equals(Object)" because "stopType" is null
at it.osm.gtfs.input.GTFSParser.readStops(GTFSParser.java:106)
at it.osm.gtfs.commands.CmdUpdateGTFSOSMData.updateBusStops(CmdUpdateGTFSOSMData.java:76)
at it.osm.gtfs.commands.CmdUpdateGTFSOSMData.call(CmdUpdateGTFSOSMData.java:59)
at it.osm.gtfs.commands.CmdGenerateBusStopsImport.call(CmdGenerateBusStopsImport.java:62)
at it.osm.gtfs.commands.CmdGenerateBusStopsImport.call(CmdGenerateBusStopsImport.java:45)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at it.osm.gtfs.GTFSOSMImport.main(GTFSOSMImport.java:211)
A quick comparison of the gtfs data used (Turin) and the ones above shows no strings present in this case. Is a rebuild necessary after changing the configuration file (gtfs-import.properties)? Trying to select the GTFSPlugin in the configuration file leads to:
Loading config properties...
Exception in thread "main" java.lang.IllegalArgumentException: An error occurred while loading config properties: The specified plugin was not found or is not valid
at it.osm.gtfs.utils.GTFSImportSettings.(GTFSImportSettings.java:101)
at it.osm.gtfs.utils.GTFSImportSettings.init(GTFSImportSettings.java:106)
at it.osm.gtfs.GTFSOSMImport.main(GTFSOSMImport.java:196)
OS = Ubuntu22.04
gtfs-osm-import.jar from the latest built
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.