Skip to main content

Hi, I'm trying to dynamically create the line drawings in a GTFS, that is, I want to create the shapes table, which is empty by default. I thought that it must be possible to do from the stop_times table, the stops table and the 'mother' lines in kml that contain the total theoretical route of each line. With stop_times I can know all the patterns that each line has (starts and ends) identified with stop code.

 

patterns from stop_times.txt
stops.txt, with coords


 
The spicy part starts here. I should cut the parent line by start and end, keep the correct segment - I don't know how to identify it - and reorient it in case the 0 vertex of the line doesn't match the stop coords origin The thing is, I don't quite know how to do it. Any help would be appreciated.

 

Thank you very much!

Pol

 

PD: I cannot attach KML on this thread. ‘Mother’ lines comes from there:

R11: https://www.google.com/maps/d/u/0/viewer?mid=1Oovi7a-WCKVFI_h4IigcGDBCXPo&femb=1&ll=41.91271293489377%2C2.6520825662537018&z=9

R15: https://www.google.com/maps/d/u/0/viewer?mid=1G2OXx2RDyBAjBsVB0a6u0XRYWjY&femb=1&ll=41.24720744518247%2C1.2577949999999927&z=10

 

Hello @pcarrerabalsell 

It sounds like you already have a GTFS file since you have stops.txt.

Are you certain shapes.txt is empty? It should be populated with vertices of the routes contained in the GTFS file. Unzip the GTFS zip file and open shapes.txt in a text editor. It should look something like the example as shown in https://developers.google.com/transit/gtfs/examples/gtfs-feed#shapestxt

Are you able to share why you need to create a shapes.txt?


I don't understand the core of the problem.

 

You are reading 2 files. One with lines and one with points?

And you want the line to start at the position where there is a point with a stop attribute? So if the line is ending at a point with a stop attribute you want to reverse it?

 

Are you having trouble testing if the line starts or ends at the point?

Are you having trouble using the Orientor?

Or is this something specific to GTFS files that I don't know of?

 

 


hi @debbiatsafe and @jkr_wrk ,

 

I want a gtfs with shapes to be displayed in a mobility application for which we are responsible for the backoffice.

Actually this gtfs comes without shapes.txt in source, it is not a mandatory file. We cook and adapt this gtfs to our mobility application needs.


One of the operations is to build the shapes. 

Until now we inserted the shapes manually, but due to the constant change of trips in the gtfs this involves a lot of manual work.


What I wanted was to automate the construction of shapes depending on the trips and include it in the same workflow where gtfs is 'cooked'. 

 

I had thought of building it from the stop_times table, stops table and the master lines in kml. 

 

I managed to get a non-spatial table with trip id, origin stop id and destination stop id. I could cut the kml master for each trip with stops from the stops table. Then, if appropriate, reorient the line so that vertex 0 coincides with the coordinates of the origin stop.

The problem is that I'm not sure how to do it fully autonomously and automatically.

I hope I explained myself better.

Thanks in advance.

 

Pol

 

 

 


 The problem is that I'm not sure how to do it fully autonomously and automatically.

 

So you know what steps to make. Do you know how to do each individual step automaticly or is there some manual thinking involved? Do you have trouble with the order of steps, or with connecting the steps?

It sometimes feels way to complex when you build all the steps together, but it is usually just how it should be done. Take it step by step, take a small dataset with simple examples and start building.

If we could help with any of the steps, feel free to ask.

Good to know the whole process and the little problems.

 


Reply