Scenario: One OTP (Open Trip Planner) router which has multiple, say 2 for example, GTFS (General Transit Feed Specification) feeds. Each feed is generated by different agencies, one has trains and the other buses. However both have the agency id set to 1 in the GTFS feed, which is correct since according to the spec this agency is is only guarantied to be unique within a data set, in these case there are two separate data sets.

  • Is it possible to control how these ids are handled by OTP?

I need to query them using the REST API but can't predict which id they would get, since it is determined by OTP on load.

  • Any suggestions?

More detail: The rest api call looks like the one below (more info in the OTP rest apidoc). The {routerId} is fixed in configuration, so its known and there is no problem with it. However, the {stopId} it is formed by concatenating the agencyId and the stopId (the later one being the stopId from the feed so its known).


Example: Lets suppose two feeds that define an agency each one:

1, AgencyA, ......

1, AgencyB, ......

Each feed guaranties that the AgencyId (1 in both cases) its unique within then feed, so they may be the same (because they are two separate feeds).

Also each feed defines a stop (which may or may not have the same stop id, let's assume they are different in this case) as follow:

1, Stop1, .....

2, Stop2, .....

Finally we set this in a OTP router named sandbox.

The rest call would look like this for the stop from AgencyA:


Where the first 1 corresponds to the agency id, and the later to the stop.

But because both agencies have the same id, the second one would get its id changed to F1 (at least in version 0.19 which is the one I', using right now), so the rest call would look like:


The problem is how can I know the newly created agencyId and if it is possible to control it on import. I could configure the client so it knows which otpAgencyId corresponds to which agencyId from a feed, but if I add a new GTFS feed these ids may change requiring reocnfiguration. So I has hopping to be able to control the ids set by OTP so they are asigned in a deterministic way.

closed as unclear what you're asking by Vince, Andre Silva, Mapperz Nov 23 '16 at 18:23

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please edit the question to define the terms "OTP" and "gtfs". – Vince Nov 23 '16 at 11:55
  • @Vince, added definitions and tag – Javier Mr Nov 23 '16 at 13:43
  • @Vince and others, could you detail what its missing in the question?, the fact is simple one OTP loading 2 GTFS feeds with same agency id (ok according to spec, as stated) which get redifined on load; and asking if it is possible to control that since I need to use the rest api to query info. – Javier Mr Nov 24 '16 at 6:59
  • 1
    Can you request by agency name? or perhaps prefix some identifier to the agency identifiers ? I think it would be useful for others trying to understand the problem if you could show a bit of the feeds, and link to the API you want to use – nmtoken Nov 24 '16 at 7:57