Shapes.txt in GTFS, is it needed?

778 views
Skip to first unread message

Diego Canales

unread,
Sep 8, 2014, 6:18:55 PM9/8/14
to transit-d...@googlegroups.com
Hi Guys - We are using this tool to produce GTFS from shapefiles, but it does not produce the shapes.txt file. This file is listed as optional, so my question is what is the value of producing it, and does it impact the routing done, say by Google Transit, OTP or any other transit app? 

Thanks,
Diego

Adrian Schönig

unread,
Sep 8, 2014, 10:02:21 PM9/8/14
to transit-d...@googlegroups.com
Hi Diego,

shapes.txt is not needed for routing as the other files have all the relevant information. shapes.txt is mostly for making results look a lot better when plotting them on the map as the routes will can then be displayed to follow the way the service goes rather than just as straight lines between stops.

Regards,
Adrian

John Whitlock

unread,
Sep 8, 2014, 10:14:25 PM9/8/14
to transit-d...@googlegroups.com
This page suggests that Google will accept a feed without shapes, but that they don't recommend it, because "it is not visually appealing": 


Also, if you do provide a shape, every stop needs to be within 30 meters of the shape, or Google will ignore it and go back to the stop-to-stop representation.



--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Smith

unread,
Sep 9, 2014, 1:46:08 PM9/9/14
to transit-d...@googlegroups.com
Yes, the shapes are not actually used for generating transit trip plans. The key issue is indeed that the User Interface is not as appealing if shapes are not provided.

But one should also keep in mind that can use GTFS to configure a CAD/AVL system and such a system won't work as well if the shapes are not provided. It is more difficult to generate accurate arrival predictions and management information if the system doesn't know exactly where the vehicles are supposed to travel. The systems can still work, but they won't work as well.

Mike

Diego Canales

unread,
Sep 9, 2014, 4:52:32 PM9/9/14
to transit-d...@googlegroups.com
Thanks everyone for the heads-up.

Diego


On Tuesday, September 9, 2014 1:46:08 PM UTC-4, Michael Smith wrote:
Yes, the shapes are not actually used for generating transit trip plans. The key issue is indeed that the User Interface is not as appealing if shapes are not provided.

But one should also keep in mind that can use GTFS to configure a CAD/AVL system and such a system won't work as well if the shapes are not provided. It is more difficult to generate accurate arrival predictions and management information if the system doesn't know exactly where the vehicles are supposed to travel. The systems can still work, but they won't work as well.

Mike
On Mon, Sep 8, 2014 at 7:14 PM, John Whitlock <John-W...@ieee.org> wrote:
This page suggests that Google will accept a feed without shapes, but that they don't recommend it, because "it is not visually appealing": 


Also, if you do provide a shape, every stop needs to be within 30 meters of the shape, or Google will ignore it and go back to the stop-to-stop representation.


On Mon, Sep 8, 2014 at 5:18 PM, Diego Canales <dcanales...@gmail.com> wrote:
Hi Guys - We are using this tool to produce GTFS from shapefiles, but it does not produce the shapes.txt file. This file is listed as optional, so my question is what is the value of producing it, and does it impact the routing done, say by Google Transit, OTP or any other transit app? 

Thanks,
Diego

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.

Sean Barbeau

unread,
Sep 10, 2014, 10:42:05 AM9/10/14
to transit-d...@googlegroups.com
Diego,
On a related note - in case you weren't monitoring the group emails (or for anyone who stumbles on this post in the future), there was a recent conversation on how to generate shapes.txt:
https://groups.google.com/forum/#!topic/transit-developers/EIe2dRsRWyY

Sean

Diego Canales

unread,
Sep 10, 2014, 11:41:38 AM9/10/14
to transit-d...@googlegroups.com
Sean,

Thanks I had seen it when revising the threads. One question related to this. If I happen to already have the routes in a shapefile (polylines), can I simply export them into a point shape and then into a csv, which would turn into my shapes.txt file? Am I correct with my reason, or would there be any caveats I should be aware of? 

Diego

To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.

Barbeau, Sean

unread,
Sep 10, 2014, 11:53:09 AM9/10/14
to transit-d...@googlegroups.com

Diego,

True, if you already have the routes as polylines (which represent all your possible trips), then you should be able to simply dump this geometry for the shapes.txt file.  Only issue would be if your route shapefiles don’t represent the unique travel paths for all your trips – then you’d need a way to represent the differences.

 

Sean

To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to a topic in the Google Groups "Transit Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/transit-developers/69cjZnnm-nA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to transit-develop...@googlegroups.com.

Nisar Ahmed

unread,
Sep 10, 2014, 12:56:34 PM9/10/14
to transit-d...@googlegroups.com
Diego,

I would first create (unless you already have them) polylines for patterns (aka variants) that represent each group of unique trips. Then any GIS software can help dump those into point shapes.

--Nisar

Sent from my iPhone

Steven Judd

unread,
Sep 10, 2014, 3:29:21 PM9/10/14
to transit-d...@googlegroups.com

There are also some key issues with shapefiles that must be addressed when converting shapefiles into a shapes.txt file.

  1. As others have been described earlier, each unique path that your buses take (i.e. patterns, variants, etc; I will call them variants) must be mapped. There are a variety of methods of doing this, from using a directions generator loaded with all of the stops, to manually selecting road centerlines or manually drawing the path.
  2. Concurrently, some method of tracking the direction of the variant must be captured. Google and other transit software (ex. TransitMaster and other AVLs) uses linear referencing to enable more precise tracking of bus locations and paths, and it allows for dead reckoning if such the feature exists in the system.  For shapefiles, this must be accomplished by using M aware polylines, as each individual vertex must be numbered sequentially in the correct direction of bus travel. Other solutions such as geodatabases or spatially-enabled databases are possible, but please note: "The values for shape_pt_sequence must be non-negative integers, and they must increase along the trip."
    1. When using linear referencing in ArcGIS, you can accomplish this as well as the optional field of line distance by creating routes for each of the individual fields and populating the M values with distance (note that the data must be projected, and not just in a datum such as WGS 1984).
  3. Every trip in your feed MUST be associated with a shape in order to illustrate the fields properly.

I have a python script for exporting M polyline shapefiles (or geodatabases, I don't remember) into GTFS format, which I will post later.

Thanks,

Steven

Barbeau, Sean

unread,
Sep 10, 2014, 3:36:27 PM9/10/14
to transit-d...@googlegroups.com

A quick clarification – you can do whatever projections, processing, etc. internally to generate the line, but the final shape_pt_lat and shape_pt_lon in GTFS shapes.txt must be in WGS 84.

 

Sean

dav...@gmail.com

unread,
Sep 12, 2014, 7:16:04 PM9/12/14
to transit-d...@googlegroups.com
Hi Steve,
Could you please post the script.
Thanks
Daniel

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Transit Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/transit-developers/69cjZnnm-nA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to transit-developers+unsub...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.

Diego Canales

unread,
Sep 17, 2014, 3:21:10 PM9/17/14
to transit-d...@googlegroups.com, dav...@gmail.com
Thanks everyone for the answers.

Steve - Having access to that script would indeed be very helpful.

Diego

Steven Judd

unread,
Sep 17, 2014, 3:32:19 PM9/17/14
to transit-d...@googlegroups.com

Sorry guys, I've misplaced the hard drive with the files. I'll look for it and see about getting it up on Friday

To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.

Daniel Vivar

unread,
Sep 17, 2014, 3:34:40 PM9/17/14
to transit-d...@googlegroups.com
Great thanks!

To unsubscribe from this group and all its topics, send an email to transit-develop...@googlegroups.com.

Landon Reed

unread,
Sep 17, 2014, 10:01:24 PM9/17/14
to transit-d...@googlegroups.com, dav...@gmail.com
Just to pull some of the relevant bits out of Sean's previous mention of the other thread.  I wrote a tool that uses an OpenStreetMap network to generate shapes.txt from GTFS.  There are some limitations, but it works pretty well in most cases:

Great thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Transit Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/transit-developers/69cjZnnm-nA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to transit-developers+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rusty....@gmail.com

unread,
Sep 19, 2014, 1:56:15 PM9/19/14
to transit-d...@googlegroups.com
Quick question.  When plotting the routes and entering lat/long points for each shape, is it necessary to plot each route from begining to end?  For example, my inbound routes differ from the outbound routes between transfer centers, so the shapes will have deviations from eachother depending on which direction the bus is travelling.  Is it more beneficial to draw overlapping lines regarding the shapes (i.e. bus travels down second street and then back up second street, resulting in two lines) or is it only necessary to chart a single path and the system determines where the bus is on the route based on designated stop times?  Am I making any sense? haha.  Thanks in advance!

Roj Prasad

unread,
Oct 8, 2014, 10:29:14 PM10/8/14
to transit-d...@googlegroups.com, rusty....@gmail.com
Absolutely! Many road routes split for E & W or N & S direction so these short splits must be plotted for a nice looking view for the user's trip planning. Manually this is a pain so we automated the process.
Good Luck.

FYI: 
We developed an application that has a map layer to automatically read my plot points along a route, save to a database and generate my shapes.txt file. We developed a Transit Manager Application for GTFS from scratch. We are currently testing our client's 197 trips on the GTFS Partner Dashboard, preparing for Launch. 

Our Transit Manger for GTFS  available for licensing. The Web Epoch Transit Manager Application also powers the 35+ NY PABT KIOSK with our client's daily commuter trip schedule via XML. 

Nandawon Tech

unread,
Oct 9, 2014, 12:13:21 PM10/9/14
to transit-d...@googlegroups.com, dav...@gmail.com
Hi Landon

Do you also have a tool to generate rail routes from OSM network?

Cheers


Leo 

Landon Reed

unread,
Oct 9, 2014, 1:32:40 PM10/9/14
to transit-d...@googlegroups.com, dav...@gmail.com
Unfortunately, I don't.  The script relies on OSRM (http://project-osrm.org/) for the routing.  There may be a way to repurpose that software to draw on the rail network rather than the road network, but I haven't looked at this.

An alternative approach may be just to pull out the OSM ways for the rail network (e.g., using the Overpass API - example + resulting gist) and just construct the shapes from there.


---
Landon Reed  | http://landonreed.net

To unsubscribe from this group and all its topics, send an email to transit-develop...@googlegroups.com.

sabre23t

unread,
Oct 10, 2014, 4:50:36 AM10/10/14
to transit-d...@googlegroups.com, rusty....@gmail.com
On Thursday, 9 October 2014 10:29:14 UTC+8, Roj Prasad wrote:
Absolutely! Many road routes split for E & W or N & S direction so these short splits must be plotted for a nice looking view for the user's trip planning. Manually this is a pain so we automated the process.

Building up a route using the directions feature in Google Maps or Google My Maps is quite easy. When you're lucky the route could just be defined by starting point and end point only. If not, adding one or two "via points" by dragging on the route will make it so. This could be saved in a My Maps directions layer, and exported to KML. The KML has <LineString> element with coordinates of all generated points on the route.

Next thing is just to get that KML into a shapes.txt format. Mmm .... anyone? ;-}

I had a look at this earlier post by Brandon https://groups.google.com/forum/#!topic/transit-developers/K8EfxwC-RRU referring to http://bmander.com/makeshapes/ . But that takes My Maps line elements only, doesn't take driving directions map.


Reply all
Reply to author
Forward
0 new messages