opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.15k stars 1.02k forks source link

404 errors when using GTFS files with fares info #1475

Closed kalon33 closed 3 years ago

kalon33 commented 10 years ago

Hi,

Since I added fares files to GTFS files I have, I got this kind of error (fares files seems to be in compliance with the spec though):

javax.ws.rs.NotFoundException: HTTP 404 Not Found at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:266) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:252) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1023) at``org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:364) at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:217) at``org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) at java.lang.Thread.run(Thread.java:745)

That prevents me from having any results when looking for a trip. When I remove fares files from the GTFS files, that works properly.

I don't know what don't works, but at least it should output something even if there's some problems calculating fares I think.

Thanks for your work on fixing this.

kalon33 commented 10 years ago

After further testing it seems that either OTP doesn't support that two different GTFS datasets have the same fare_id, or that it doesn't behave ok when currencies are in lowercase instead of uppercase (and doesn't complain of it)

buma commented 10 years ago

So how many GTFS datasets do you have? Do they have different agency ids?

kalon33 commented 10 years ago

I have 5 different datasets now (and have the same error). Amongst these 5, 2 have the OCESN id, and 2 have the "1" agency id. The other one has another id (transgironde_33). That's because they are different networks from the same operators (so different GTFS files).

----- Mail original -----

De: "Marko Burjek" notifications@github.com À: "opentripplanner/OpenTripPlanner" OpenTripPlanner@noreply.github.com Cc: "Nicolas Derive" kalon33@ubuntu.com Envoyé: Lundi 25 Août 2014 00:02:22 Objet: Re: [OpenTripPlanner] 404 errors when using GTFS files with fares info (#1475)

So how many GTFS datasets do you have? Do they have different agency ids?

— Reply to this email directly or view it on GitHub .

kalon33 commented 10 years ago

Forgot to mention: OTP detects when datasets have the same ID and creates a new id for the 2nd occurrence.

abyrd commented 10 years ago

@kalon33 OTP uses an external GTFS loading library which does not really distinguish between feeds and agencies. In most cases we've encountered we don't want the same ID across different feeds (this causes very confusing errors when for example three agencies all use the ID "1"). We are about half finished with replacing this library with our own code, at which point OTP will be able to distinguish between feed IDs and agency IDs.

A short term solution might be to merge all the GTFS feeds from the same operator into a single feed before loading it into OTP. There are existing merge tools for GTFS.

kalon33 commented 10 years ago

@abyrd : service periods are not disjoint, so I cannot merge them (using Merge.py in googletransitfeed utils):

'calendar.txt/calendar_dates.txt'

'The service periods could not be merged since they are not disjoint.'

Thats another part of my problem...

buma commented 10 years ago

Maybe try with OBA merge even though I didn't have much succes with it when merging city and intercity bus schedule.

laurentg commented 10 years ago

Also one problem of fares in GTFS is that they do not fully modelize real world fares which are often more complex than what GTFS can model.

abyrd commented 10 years ago

Though there's been a lot of work on properly modeling fares in GTFS, I find that real-world systems are complicated enough that we might as well just model cross-agency interactions in code, with custom fare modules.

kalon33 commented 10 years ago

@laurentg I'm OK with you. It's a shame when trying to model one commercial network modelised using two GTFS files (one for bus, one for tramway), which has the same € 1.40 ticket which allows 1h transit between both buses and tramways, but where you can't buy your ticket in tramway, whereas you can in the bus.

I can't model this (or something near this) using two different GTFS datasets (as the free transit is apparently not possible), but as soon as I can't merge these two files, I'm stuck.

kalon33 commented 10 years ago

@abyrd: btw, it's unrelated but I don't know what your process is to get PR included: could you merge PR#1474 ? It will make OTP almost entirely translated into French.

Thanks for doing this (and sorry for the noise as its not relevant to this issue)

koch-t commented 10 years ago

Use onebusaway-transformer, it's very easy to merge the feeds

java -jar onebusaway-gtfs-transformer-cli.jar gtfs1.zip gtfs2.zip gtfscombo.zip

On Mon, Aug 25, 2014 at 2:39 PM, Nicolas Derive notifications@github.com wrote:

@laurentg https://github.com/laurentg I'm OK with you. It's a shame when trying to model one commercial network modelised using two GTFS files (one for bus, one for tramway), which has the same € 1.40 ticket which allows 1h transit between both buses and tramways, but where you can't buy your ticket in tramway, whereas you can in the bus.

That's also another part of the problem I have merging those two files...

— Reply to this email directly or view it on GitHub https://github.com/opentripplanner/OpenTripPlanner/issues/1475#issuecomment-53258515 .

abyrd commented 10 years ago

Thanks @skywave for the tip. Of course ideally we would like OTP to support at least basic fare calculation across multiple feeds/operators, but that's not realistic until we have control over the feed/agency distinction (rewrite the GTFS loader).

abyrd commented 10 years ago

@kalon33 thanks for your translation contribution and for fixing the stray commit as suggested by Sean Barbeau. I will merge it. You are right to remind me to review this kind of straightforward contribution and get it finished. In such cases don't hesitate to contact me via email off-list.

kalon33 commented 10 years ago

@abyrd you're welcome :) It's ready to be merged to my translator point of view (I made two very small fixes this morning after the fix following @barbeau comments, to adapt some strings to their context)

----- Mail original -----

De: "Andrew Byrd" notifications@github.com À: "opentripplanner/OpenTripPlanner" OpenTripPlanner@noreply.github.com Cc: "Nicolas Derive" kalon33@ubuntu.com Envoyé: Mardi 26 Août 2014 10:32:36 Objet: Re: [OpenTripPlanner] 404 errors when using GTFS files with fares info (#1475)

@kalon33 thanks for your translation contribution and for fixing the stray commit as suggested by Sean Barbeau. I will merge it. You are right to remind me to review this kind of straightforward contribution and get it finished. In such cases don't hesitate to contact me via email off-list.

— Reply to this email directly or view it on GitHub .

kalon33 commented 10 years ago

@skywave Unfortunately, I've errors using this one:

org.onebusaway.csv_entities.exceptions.CsvEntityIOException: io error: entityType=org.onebusaway.gtfs.model.Stop path=stops.txt lineNumber=177 at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:161) at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:120) at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:115) at org.onebusaway.gtfs.serialization.GtfsReader.run(GtfsReader.java:172) at org.onebusaway.gtfs.serialization.GtfsReader.run(GtfsReader.java:160) at org.onebusaway.gtfs_transformer.GtfsTransformer.readGtfs(GtfsTransformer.java:152) at org.onebusaway.gtfs_transformer.GtfsTransformer.run(GtfsTransformer.java:122) at org.onebusaway.gtfs_transformer.GtfsTransformerMain.runApplication(GtfsTransformerMain.java:200) at org.onebusaway.gtfs_transformer.GtfsTransformerMain.run(GtfsTransformerMain.java:92) at org.onebusaway.gtfs_transformer.GtfsTransformerMain.main(GtfsTransformerMain.java:71) Caused by: org.onebusaway.gtfs.serialization.DuplicateEntityException: duplicate entity id: type=org.onebusaway.gtfs.model.Stop id=1_BFLEU at org.onebusaway.gtfs.serialization.GtfsReader$EntityHandlerImpl.registerAgencyId(GtfsReader.java:271) at org.onebusaway.gtfs.serialization.GtfsReader$EntityHandlerImpl.handleEntity(GtfsReader.java:249) at org.onebusaway.csv_entities.CsvEntityReader$EntityHandlerImpl.handleEntity(CsvEntityReader.java:225) at org.onebusaway.csv_entities.IndividualCsvEntityReader.readEntity(IndividualCsvEntityReader.java:148) at org.onebusaway.csv_entities.IndividualCsvEntityReader.handleLine(IndividualCsvEntityReader.java:98) at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:157) ... 9 more

Whereas both GTFS files I want to merge are properly parsed by OTP.

koch-t commented 10 years ago

It's probably possible with some transform command, maybe ask in the onebusaway list. Otherwise build a tool yourself.

On Tue, Aug 26, 2014 at 6:41 PM, Nicolas Derive notifications@github.com wrote:

@skywave https://github.com/skywave I've errors using this one (and got another one using OBA merge):

org.onebusaway.csv_entities.exceptions.CsvEntityIOException: io error: entityType=org.onebusaway.gtfs.model.Stop path=stops.txt lineNumber=177 at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:161) at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:120) at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:115) at org.onebusaway.gtfs.serialization.GtfsReader.run(GtfsReader.java:172) at org.onebusaway.gtfs.serialization.GtfsReader.run(GtfsReader.java:160) at org.onebusaway.gtfs_transformer.GtfsTransformer.readGtfs(GtfsTransformer.java:152) at org.onebusaway.gtfs_transformer.GtfsTransformer.run(GtfsTransformer.java:122) at org.onebusaway.gtfs_transformer.GtfsTransformerMain.runApplication(GtfsTransformerMain.java:200) at org.onebusaway.gtfs_transformer.GtfsTransformerMain.run(GtfsTransformerMain.java:92) at org.onebusaway.gtfs_transformer.GtfsTransformerMain.main(GtfsTransformerMain.java:71) Caused by: org.onebusaway.gtfs.serialization.DuplicateEntityException: duplicate entity id: type=org.onebusaway.gtfs.model.Stop id=1_BFLEU at org.onebusaway.gtfs.serialization.GtfsReader$EntityHandlerImpl.registerAgencyId(GtfsReader.java:271) at org.onebusaway.gtfs.serialization.GtfsReader$EntityHandlerImpl.handleEntity(GtfsReader.java:249) at org.onebusaway.csv_entities.CsvEntityReader$EntityHandlerImpl.handleEntity(CsvEntityReader.java:225) at org.onebusaway.csv_entities.IndividualCsvEntityReader.readEntity(IndividualCsvEntityReader.java:148) at org.onebusaway.csv_entities.IndividualCsvEntityReader.handleLine(IndividualCsvEntityReader.java:98) at org.onebusaway.csv_entities.CsvEntityReader.readEntities(CsvEntityReader.java:157) ... 9 more

Whereas both GTFS files I want to merge are properly parsed by OTP.

— Reply to this email directly or view it on GitHub https://github.com/opentripplanner/OpenTripPlanner/issues/1475#issuecomment-53450797 .