Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation help #206

Open
ragavendra opened this issue Mar 19, 2024 · 9 comments
Open

Documentation help #206

ragavendra opened this issue Mar 19, 2024 · 9 comments

Comments

@ragavendra
Copy link

hi,

I was able to generate the timetable.dat file, however I am not sure on how to go about reading it?

PS - I was here as I thought that this repo can help in routing between two stops or co - ordinates using the GTFS static data.

@skinkie
Copy link
Contributor

skinkie commented Mar 19, 2024

I was able to generate the timetable.dat file, however I am not sure on how to go about reading it?

Do you mean 'how can I visualise timetable.dat' or 'how can I use it in a journey planner'?

PS - I was here as I thought that this repo can help in routing between two stops or co - ordinates using the GTFS static data.

It certainly can :-)

@ragavendra
Copy link
Author

ragavendra commented Mar 19, 2024

Irrespective, I know the db file is a sqlite file, which I can view using the sqlite viewer. Say I have two co-ordinates like latitude and longitude of it. I need a way to get the route(s) from the dat file. Is that possible?

I am not aware of journey planner. Is it an app or something?

It certainly can :-)

Nice to know 👍 . I am planning to add routing to stopsnearme.ca

I know transfers file is one way, but I doubt if it is exhaustive

Edit - I was able to build the cli file. I generated the timetable.dat file from agency here. I am getting

The input file timetable.dat does not appear to be a timetable or is of the wrong version.

I am now trying with the huge gtfs file from the readme. I will post update(s) here.

@skinkie
Copy link
Contributor

skinkie commented Mar 19, 2024

Irrespective, I know the db file is a sqlite file, which I can view using the sqlite viewer. Say I have two co-ordinates like latitude and longitude of it. I need a way to get the route(s) from the dat file. Is that possible?

Sure, first I would suggest to take this branch: https://github.com/bliksemlabs/rrrr/tree/tdata-cherokee
Then check https://github.com/bliksemlabs/rrrr/blob/tdata-cherokee/api.h#L11
You would build a router_request_t, which works with coordinates. It is kind of a nearest match of a (set of) stop(s).

The 'cli' application is also capable of doing so.
There is also some python code available but I don't think I have published it for python3.

I am not aware of journey planner. Is it an app or something?

This entire library is the journey planner.

I know transfers file is one way, but I doubt if it is exhaustive

Transfers is mainly required to make sure the relationships between stops are known. When we made this software we decided it was better to do this a prori, than every time at run time.

Edit - I was able to build the cli file. I generated the timetable.dat file from agency here. I am getting

The input file timetable.dat does not appear to be a timetable or is of the wrong version.

I am now trying with the huge gtfs file from the readme. I will post update(s) here.

My expectation: it might be related to (older) python versions. It is still on my todo list to have a better way to build timetable.dat. We have never used the GTFS to timetable4.dat method, but fetched the information from the source database that produces the GTFS output.

@ragavendra
Copy link
Author

ragavendra commented Mar 20, 2024

Sure, first I would suggest to take this branch: https://github.com/bliksemlabs/rrrr/tree/tdata-cherokee Then check https://github.com/bliksemlabs/rrrr/blob/tdata-cherokee/api.h#L11 You would build a router_request_t, which works with coordinates. It is kind of a nearest match of a (set of) stop(s).

My C or C++ skills are limited :) . I will go through it and try to understand.

I know transfers file is one way, but I doubt if it is exhaustive

Transfers is mainly required to make sure the relationships between stops are known. When we made this software we decided it was better to do this a prori, than every time at run time.

I agree. I meant I doubt if a lot of agencies have it for all the stops near each other.

Edit - I was able to build the cli file. I generated the timetable.dat file from agency here. I am getting

The input file timetable.dat does not appear to be a timetable or is of the wrong version.

My expectation: it might be related to (older) python versions. It is still on my todo list to have a better way to build timetable.dat. We have never used the GTFS to timetable4.dat method, but fetched the information from the source database that produces the GTFS output.

I am using Python 2.7.17 with pyenv. I got like below earlier, when using Python 3.11.17

File "/..../rrrr/gtfsdb.py", line 415
    print "1-day service on %s" % (feed_start_date)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

FYI - I am still getting the same issue using the gtfs file from the readme.

Also, I had to switch to master branch to use the python scripts. Let me know if you want me to submit a PR to copy them to the working tdata-cherokee branch. I can update the readme as well to make a new user to onboard easily.

Edit -
In tdata-cherokee branch when running python gtfs2rrrr.py ../../gtfs-nl.zip , I got like below and no timetable4.dat was generated.

Completed 1
Timetable valid from 2024-03-13 to 2024-04-14, timezone: Europe/Amsterdam
Killed

@skinkie
Copy link
Contributor

skinkie commented Mar 20, 2024

My goal would be to have the python library compilation working again, and have the ability to generate the timetable4.dat. I'll try to look into it again the next few days.

@skinkie
Copy link
Contributor

skinkie commented Mar 20, 2024

@ragavendra the goal is currently to get a NeTEx file/profile which mimmics the fileformat in the most transparent way. I have mapped most of the format at this moment. So I'll produce some test outputs. Then I'll have to basically rewrite the exporter. I hope that will be done tomorrow.

@ragavendra
Copy link
Author

NeTEx

Sure, I just read about it, it says xml. Isn't there anything newer like json or similar?

I was checking gtfs2rrrr.py on another region's gtfs zip file. I got the below error.

Timetable valid from 2024-02-29 to 2024-04-01, timezone: America/Edmonton
Traceback (most recent call last):
  File "gtfs2rrrr.py", line 154, in <module>
    main()
  File "gtfs2rrrr.py", line 147, in main
    tdata = convert(gtfsdb, from_date)
  File "gtfs2rrrr.py", line 90, in convert
    if len(index.operators) == 1:
NameError: global name 'index' is not defined

I checked it on my region first and this was the result.

Completed 1
Timetable valid from 2024-01-01 to 2024-02-02, timezone: America/Vancouver
Traceback (most recent call last):
  File "gtfs2rrrr.py", line 154, in <module>
    main()
  File "gtfs2rrrr.py", line 151, in main
    exporter.timetable4.export(tdata)
  File "/run/media/scion/96242da8-b37a-4597-9b64-93d7374c1a9f/repos/rrrr/rrtimetable/rrtimetable/exporter/timetable4.py", line 646, in export
    index = make_idx(tdata)
  File "/run/media/scion/96242da8-b37a-4597-9b64-93d7374c1a9f/repos/rrrr/rrtimetable/rrtimetable/exporter/timetable4.py", line 87, in make_idx
    if line.physical_mode.uri not in index.idx_for_physical_mode_uri:
AttributeError: Line instance has no attribute 'physical_mode'

Also, I was unable to download the dat file.

@skinkie
Copy link
Contributor

skinkie commented Mar 20, 2024

Sure, I just read about it, it says xml. Isn't there anything newer like json or similar?

LOL. It is just a serialisation format. And you should not work with serialisation formats, you should work with objects in your programming language of choice.

@skinkie
Copy link
Contributor

skinkie commented Mar 22, 2024

@ragavendra some progres has been made :-)
https://github.com/bliksemlabs/rrrr/wiki/NeTEx-rrrr%E2%80%90profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants