GulfSo
GulfSo

Reputation: 13

Display GTFS - Routes on a Map without Shapes

I try to consume some GTFS Feeds and work with them. I created a MySQL Database and a Python Script, which downloads GTFS - Files and import them in the right tables.

Now I am using the LeafLet Map - Framework, to display the Stops on the map. The next step is to display the routes of a bus or tram line on the map. In the GTFS - Archive is no shapes.txt.

Is there a way to display the routes without the shapes.txt ?

Thanks!

Kali

Upvotes: 1

Views: 2106

Answers (2)

vcp
vcp

Reputation: 962

You will have to generate your own shape using underlying street data or public transit lines. See detailed post by Anton Dubrau (he is an angel for writing this blog post).

https://medium.com/transit-app/how-we-built-the-worlds-prettiest-auto-generated-transit-maps-12d0c6fa502f

Specifically:

Here’s an example. In the diagram below, we have a trip with three stops, and no shape information whatsoever. We extract the set of tracks the trip uses from OSM (grey lines). Our matching algorithm then finds a trajectory (black line) that follows the OSM, while minimizing its length and the errors to the stops (e1, e2, e3).

Upvotes: 0

abeboparebop
abeboparebop

Reputation: 7775

The only alternative to using shapes.txt would be to use the stops along the route to define shapes. The laziest way would be to pick a single trip for that route, get the set of stops from stop_times.txt, and then get the corresponding stop locations from stops.txt.

If you wanted or needed to, you could get a more complete picture by finding the unique ordered sets of stops among all of the trips on that route, and define a shape for each ordered set in the same way.

Of course, these shapes would only be rough estimates because you don't have any information about the path taken by the vehicles between stops.

Upvotes: 1

Related Questions