patrickbr / db-api-to-gtfs

Small hack to convert data from the Deutsche Bahn API into a valid GTFS feed
https://gtfs.de
GNU General Public License v2.0
34 stars 5 forks source link

Do not output trip['type'] as short_name of the trip #5

Closed highsource closed 8 years ago

highsource commented 8 years ago

According to the spec:

If the route does not have a short name, please specify a route_long_name and use an empty string as the value for this field.

So it's better output an empty string instead of trip['type'].

patrickbr commented 8 years ago

Hm, I am not completely sure whether that would be the right course of action here. According to the spec:

The route_short_name contains the short name of a route. This will often be a short, abstract identifier like "32", "100X", or "Green" that riders use to identify a route, but which doesn't give any indication of what places the route serves.

One could argue that a value like "ICE" does exactly that: provide a "short, abstract identifier" without any "indiciation of what places the route serves".... I guess you could argue that "ICE" or "EC" is perhaps too much of an abstraction.

Maybe it would be more appropriate to use trip['name'] ("ICE 500" for example) as the route_short_name and to keep route_long_name empty? However, the motivation for filling route_short_name with it was to prevent the loss of the trip['type'] value in the feed., Atm I cannot think of a better way to represent the three layers of abstraction contained in DB-routes (Vehicle type like "train", "Zuggattung" like "ICE" and "Linie" like "EC 500") than to use route_short_name and route_long_name... but I am open for ideas!

highsource commented 8 years ago

I've tried using ICE 500 for route_short_name but got warnings from the Google feed validator, it complained that short_name was too long.

I was also thinking about outputting "from - to" as the long name. But then I've tried the feed in the OpenTripPlanner an OTP uses short/long name together with the headsign so that would've been a bit awkward.

Now I'm getting:

BAHN: DPN, ICE 128 to Amsterdam Centraal

With type as short name I was getting:

BAHN: DPN (ICE), ICE 128 to Amsterdam Centraal

Which is worse.

There's also Gattungsgruppe. :)

Type in GTFS... Not sure it is really needed as it can be easily derived from the short_name. As an alternative we could use route_desc to provide additional information.

patrickbr commented 8 years ago

I guess the validator doesnt like the whitespace in route_short_name... I originally merged your PR with trip['name'] as route_short_name, but swapped it back to your suggestion with 7f1eaa4. If it looks better in OTP, your sugeestions wins :)

highsource commented 8 years ago

Many thanks. :+1: