New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from OTP 0.19 to latest versions - agencyIds autogeneration issue #2476

Closed
twopelu opened this Issue Jul 27, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@twopelu

twopelu commented Jul 27, 2017

Expected behavior

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.

Observed behavior

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.

Example

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 :.

Questions

  • 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).

  • 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.

Thanks!

@johannilsson

This comment has been minimized.

Show comment
Hide comment
@johannilsson

johannilsson Jul 28, 2017

Contributor

This behaviour is expected. The rational behind it is described in this issue #1990 and in PR #1999, where the previous behaviour did not work with multi agency feeds.

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 feed_id in feed_info.txt as proposed here, http://developer.trimet.org/gtfs_ext.shtml.

Hope this helps!

Contributor

johannilsson commented Jul 28, 2017

This behaviour is expected. The rational behind it is described in this issue #1990 and in PR #1999, where the previous behaviour did not work with multi agency feeds.

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 feed_id in feed_info.txt as proposed here, http://developer.trimet.org/gtfs_ext.shtml.

Hope this helps!

@abyrd

This comment has been minimized.

Show comment
Hide comment
@abyrd

abyrd Jul 28, 2017

Member

@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!

Member

abyrd commented Jul 28, 2017

@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!

@abyrd abyrd closed this Jul 28, 2017

@twopelu

This comment has been minimized.

Show comment
Hide comment
@twopelu

twopelu Jul 31, 2017

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:

https://groups.google.com/forum/#!topic/opentripplanner-users/7WDd3c0Lh7s

twopelu commented Jul 31, 2017

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:

https://groups.google.com/forum/#!topic/opentripplanner-users/7WDd3c0Lh7s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment