PTNA: news for Public Transport Network Analysis

Took me long enough, but I finally got around to finishing that GTFS import script: NeatNit/ptna-gtfs-import - Codeberg.org

It requires shapely from pip, everything else is vanilla Python.

Here’s what I landed on:

The wiki pages will have templates that look like this:

#
# This data is input for the tool: PTNA - Public Transport Network Analysis (https://ptna.openstreetmap.de)
#
# ...
#
################################
#


= Overview of the public transport in מחוז תל אביב, נפת תל אביב / Tel-Aviv Subdistrict, Tel-Aviv District

== Train
# train data in GTFS is unusable, so this must be maintained manually
Blue;train;;Jerusalem Malha;Tel Aviv Center Savidor;Israel Railways
Darkblue;train;;Hod HaSharon Sokolov;Rishon LeTsiyyon HaRishonim;Israel Railways
Darkgreen;train;;Beer Sheva;Nahariyya;Israel Railways
Lightgreen;train;;Modiin;Nahariyya;Israel Railways
-

== Light Rail
@LIGHTRAIL
-

== Bus
@BUS
-

My script will replace @LIGHTRAIL and @BUS with the appropriate CSV data. (You reserved @, +, ~, $ for later use, thanks for that!)

Usage:
ptnaGenerate.py geojson template gtfs_dir > outfile

Where geojson is a .geojson file defining the area to be analyzed
template is a file containing the template, as downloaded from the wiki
gtfs_dir is a directory containing unzipped GTFS files
and outfile is obviously where the output goes (the script just prints to stdout)

It currently spams quite a lot of verbose debugging nonsense to stderr, but this is easy to get rid of.

I can still make changes to the code of course, so for example if geojson is inconvenient for any reason we can switch to a different format or use a different geometry library.

Let me know what you think! Check out the output: Israel/Public Transport/PTNA/IL-TA-Tel-Aviv-Routes - OpenStreetMap Wiki

4 Likes