Meaning of Number and Colon in front of an id in planner ressource response

40 views
Skip to first unread message

Jan-Hendrik Hausner

unread,
Feb 21, 2022, 1:03:18 AM2/21/22
to OpenTripPlanner Developers
Hello together,

I guess the number and the colon aftern an id are supposed to guarantee the uniqueness of the ids, since there can be multiple GTFS files, right?

                        "agencyId": "1:76",
                        "tripId": "1:26298003",

Is it guaranteed that there is always a number and a colon in the id?

With best regards
Henni

Andrew Byrd

unread,
Feb 21, 2022, 1:20:28 AM2/21/22
to Jan-Hendrik Hausner, OpenTripPlanner Developers
Hi Henni,

Your interpretation is correct. This prefix before the colon ensures that the IDs are unique if more than one feed defines the same IDs. It is very common for IDs to clash since many feeds assign their entities sequential numeric IDs like 1, 2, 3 ...

This disambiguating string is referred to as the “feed ID”. You may also see people refer to it as the “scope” of the ID. This is always a number when it is automatically generated by OTP, but you can also control the feed ID by adding a feed_id column to the feed_info.txt file within your GTFS feed. In that case, the feed identifier can be a sequence of any characters except a colon or an underscore, typically only alphanumeric characters.

It wouldn’t be necessary for OTP to add this prefix when there’s only one feed loaded, but there’s some value to having consistent behavior in every case (one feed or many feeds).

Hope this helps,
Andrew

--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opentripplanner-dev/56a29b32-0c8c-4e4d-bcd0-b8fc9b69c83fn%40googlegroups.com.

Thomas Gran

unread,
Feb 21, 2022, 4:20:45 AM2/21/22
to OpenTripPlanner Developers
You should not relay on the feedScoped id as an integer prefix. I think there are a `gtfsId` on some of the entities, but it might not be supported in all APIs. NeTEx imports uses strings, not numbers for the feedScope, and we intend to remove the prefix for NeT future - since NeTEx ids are globally unique. We also want the GTFS ids to be globally unique - this mean that the id also must include the type so a Stop and a Trip can not have the same id. 

If needed we will consider to be backward compatible, hence allowing for different strategies.

Thomas
Reply all
Reply to author
Forward
0 new messages