Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Migration from OTP 0.19 to latest versions - agencyIds autogeneration issue #2476
In version 0.19 the agencyIds are taken from the GTFS files. To prevent conflict between different feeds, we modify the agencyIds manually and the OTP loads them with these ids. We have migrated to version 1.1 and the behaviour is different.
In version 1.1, when loading the GTFS files, the OTP replaces the agencyIds by internal ids in alphabeticall order, which means that we are no longer able to query the stops to calculate routes with the agencyId that we have set in the files manually.
i.e. In version 0.19 we set the agencyId to "metro" in the GTFS file and the agencies are created with that id, which works both from the OTP web and within calls to the plan method in API REST.
Now in 1.1 no matter if we set the agencyId in the GTFS file, the OTP generates their own ids ("1"), which makes it much more compicated to calculate routes with the API REST, there is no way to know the id previous to the load and build process. The agencyId is used in the params fromPlace and toPlace :.
All GTFS feeds loaded by OTP is now scoped by a feed id. This is internally and in some APIs (xml?) called agency id by OTP, this naming however is a result of a limitation in the GTFS library OTP uses but in reality it should be referred to as a feed id and nothing else. The set feed id should be reflected in the REST and GraphQL APIs. If your feeds does not provide a feed id a numeric id is generated.
To be in full control the recommended way is to provide a feed id with your GTFS feed by defining the
Hope this helps!
@twopelu to further explain: if you load more than one feed, prefixing a stop ID with an agency ID does not guarantee that the identifier is unique because nothing guarantees that both feeds have not defined the same agency ID, and because in any case stops are not associated with agencies, they are useable throughout an entire feed by multiple agencies. What we did in the past was using the ID of one agency in the feed as an ID for the entire feed, which is quite prone to error and not clean at all. So to respond to your questions:
1. Is there any way to disable this new behaviour and forcing the OTP to load the agencyIds as in previous versions? (keeping the name in the GTFS file and not generating an internal id).
No, there is no way to change back to the old system, which was not reliable. We need a unique ID for the feed, not for an agency within the feed.
Solution: just add a unique feed_id to your feed. You can add this column to feed_info.txt. OTP will then use this ID instead of an automatically generated one. In fact the automatically generated IDs are just a fallback for feeds that do not declare an ID.
2. Is there any way to query all the agencies and the ids with only one method? We are trying with the /index/feeds but we are not able to pass the param "detail" correctly. We have not found a method to query the agencies directly not knowing the id previously.
By "method" I suppose you mean HTTP API method, rather than Java method. But I don't know what you mean by "query all the agencies and the IDs". Do you mean you want a list of all the agencies, including the ID for each agency?
This issue tracking system is intended for tracking bugs and feature creation, and all usage discussion should be on the Google groups (opentripplanner-users) so that others can benefit from and participate in the discussion. Please ask your question there and we'll try to give a clear answer where other people can see it. Thanks!
Many thanks and sorry for posting here, I will go on in the groups ;-)
EDIT: I was not able to make it work, please see this new topic here: