PTNA: news for Public Transport Network Analysis

Sounds good basically, but: my home zone is the DE-BE-VBB, a very large network, perhaps somewhat unsuitable for an alpha test.
But still two small comments:

  • Maybe I misunderstood something, but I think a sorting alone by bus number will not bring any useful result here. For most counties, it could make more sense to separate according to operators, since most counties also operate their own bus company. I still have the splitting of the “other bus lines” at the bottom of my todo list
  • I recently separated trolleybus lines that are only managed as a “bus” at GTFS, I don’t know how to derive this machine

(translated with the help of lingva)

That’s not a problem - this was initially developed for Israel, which is a huge country-wide network. Size is of no concern.

Separating according to operator (or any other factors) is already working, just needs to be utilized :slight_smile:

This may require some special code to correct it. I already needed to correct some route types in Israel’s feed, so if you just point out which routes they are, we can probably sort it out. If the trolleybus lines all have an operator that only does trolleybus, that makes things easier.

Okay, I think I understand it (at my level). It seems to be structured similarly to an Overpass Turbo Query. I think I can handle that.
As initial feedback: more examples of different uses would be extremely helpful to me and would enable me to tweak the individual snippets correctly (like a script-kiddy).

The biggest problem for DE-BW-bodo, in my opinion, is that the GTFS route IDs change every year when the timetable changes (mostly around 15 December. Filtering by GTFS route IDs would therefore require annual manual updates.

Regular expressions are beyond my abilities, but I’ll try a few simple ones to start:

==== Tettnang
@route_id~^18
@@route_id~^18
-

==== Leutkirch
@route_id~^bod-6-00
@@route_id~^bod-6-00
-

==== Bad Waldsee
@route_id~^bod-8-00
@@route_id~^bod-8-00
-

The two seem fairly simple, since the route ID is unique in the area.
Now for a similarly simple case when we filter by operator:

==== Lindau
@operator=Stadtwerke Lindau
@@
-

==== Regionalverkehr Bodenseekreis / Landkreis Ravensburg
@operator=Bühler
@@
-

==== Ortsbus Immenstaad
@operator~Immenstaad
@ref~^7\d\d\d\D*$
@@
-

==== Meersburg
@comment=Ortsbus Meersburg
@@
-

==== Kressbronn
@comment=Bürgerbus Kressbronn
@@
-

==== Aulendorf
@comment=Bürgerbus Aulendorf
@@
-

So now it gets complicated for me. Will this work?

==== Ravensburg/Weingarten
@operator~(Regionalverkehr Alb-Bodensee GmbH (RAB)|Omnibus Grabherr|Hagmann|Omnibus Müller)
@route_id~^(rab-14|4|bod-5|bod-8)$
@@
-

Or even more complex. What do I do if I need an OR operator?

==== Wangen
@operator=Omnibus Verkehr Wangen
OR
@route_id~^(bod-1-|omp-94]$
-

Well, the ones you’ve already made seem great to me! You hidden German-reader! :wink:

I absolutely agree - I didn’t give that enough time or thinking, and I couldn’t really think of any good examples. Now is the time to improve that! Maybe we can borrow examples from DE-BW-bodo :smiley:

Currently not possible, but I can add that feature without too much effort if it’s necessary. I assumed that AND filters will be sufficient. You can always put two filters one after another - their results will of course be one after another, but isn’t that acceptable?

==== Wangen
@operator=Omnibus Verkehr Wangen
@@
@route_id~^(bod-1-|omp-94]$
@@
-

But as I said, if you want an OR operator I can add it. We can decide the syntax for that together, but right now I’m thinking @+ for OR:

==== Wangen
@bus
@operator=Omnibus Verkehr Wangen
@+
@bus
@route_id~^(bod-1-|omp-94]$
@@
-

I’ll run your attempts through the program and show you the results in a minute. :slight_smile:

@mcliquid sorry it took my so long, I got hung up on unrelated things.

Unfortunately, most of your regexes didn’t work - I didn’t look into why yet:

==== Tettnang
@route_id~^18
- No routes match the filter criteria
@@route_id~^18
-

==== Leutkirch
@route_id~^bod-6-00
- No routes match the filter criteria
@@route_id~^bod-6-00
-

==== Bad Waldsee
@route_id~^bod-8-00
- No routes match the filter criteria
@@route_id~^bod-8-00
-

==== Lindau
@operator=Stadtwerke Lindau
- No routes match the filter criteria
@@operator=Stadtwerke Lindau
-

==== Regionalverkehr Bodenseekreis / Landkreis Ravensburg
@operator=Bühler
40;bus;Wilhelmsdorf - Riedhausen - Hoßkirch - Ostrach;;;Bühler;DE-BW-bodo;bod-2-040-1
41;bus;Wilhelmsdorf - Deggenhausertal;;;Bühler;DE-BW-bodo;bod-2-041-1
44;bus;Wilh.Pfrungen - Zußdorf - Esenhausen - Wilhelmsdorf;;;Bühler;DE-BW-bodo;bod-2-044-1
240;bus;Wilhelmsdorf - Altshausen;;;Bühler;DE-BW-bodo;bod-2-240-1
@@operator=Bühler
-

==== Ortsbus Immenstaad
@operator~Immenstaad
@ref~^7\d\d\d\D*$
- No routes match the filter criteria
@@operator~Immenstaad ref~^7\d\d\d\D*$
-

==== Meersburg
@comment=Ortsbus Meersburg
- No routes match the filter criteria
@@comment=Ortsbus Meersburg
-

==== Kressbronn
@comment=Bürgerbus Kressbronn
- No routes match the filter criteria
@@comment=Bürgerbus Kressbronn
-

==== Aulendorf
@comment=Bürgerbus Aulendorf
- No routes match the filter criteria
@@comment=Bürgerbus Aulendorf
-

==== Ravensburg/Weingarten
@operator~(Regionalverkehr Alb-Bodensee GmbH (RAB)|Omnibus Grabherr|Hagmann|Omnibus Müller)
@route_id~^(rab-14|4|bod-5|bod-8)$
- No routes match the filter criteria
@@operator~(Regionalverkehr Alb-Bodensee GmbH (RAB)|Omnibus Grabherr|Hagmann|Omnibus Müller) route_id~^(rab-14|4|bod-5|bod-8)$
-

I’ll edit this reply in a bit (hopefully) with more detail

Edit:
So, first off:

==== Tettnang
@route_id~^18
- No routes match the filter criteria
@@route_id~^18
-

The regex ^18 means starts with 18. It seems that route_id always starts with 3 letters like bod- or rab-, so nothing starts with 18. I’m not super sure what you meant here so no suggestion here. If you want all route_ids that contain 18, that’s just: @route_id~18 (but I don’t think that’s what you meant).

Next:

==== Leutkirch
@route_id~^bod-6-00
- No routes match the filter criteria
@@route_id~^bod-6-00
-

Perhaps you meant all routes that start with bod-6-, which would look like this:

==== Leutkirch
@route_id~^bod-6-
133;bus;Stadtverkehr Leutkirch;;;Hutter Reisen;DE-BW-bodo;bod-6-133-1
134;bus;Leutkirch - Seibranz - Hauerz;;;Hutter Reisen;DE-BW-bodo;bod-6-134-1
135;bus;Leutkirch - Wuchzenhofen - Ausnang - Leutkirch;;;Hutter Reisen;DE-BW-bodo;bod-6-135-1
7569;bus;Leutkirch - Aichstetten - Aitrach;;;Hutter Reisen;DE-BW-bodo;bod-6-569-1
@@route_id~^bod-6-
-

Same goes for ^bod-8-00:

==== Bad Waldsee
@route_id~^bod-8-
30/1;bus;Bad Waldsee - Reute - Gaisbeuren - Kümmerazhofen;;;Omnibus Müller;DE-BW-bodo;bod-8-301-1
R30;bus;Bad Waldsee - Baienfurt - Weingarten - Ravensburg;;;Omnibus Müller;DE-BW-bodo;bod-8-R30-1
31;bus;Ravensburg - Weingarten - Bergatreute - Alttann - Wolfegg;;;Omnibus Müller;DE-BW-bodo;bod-8-031-1
32;bus;Roßberg - Gwigg - Bergatreute - Bad Waldsee;;;Omnibus Müller;DE-BW-bodo;bod-8-032-1
33/5;bus;Untermöllenbronn - Kümmerazhofen - Bad Waldsee Marktlinie;;;Omnibus Müller;DE-BW-bodo;bod-8-335-1
33/7;bus;Eschle - Bahnhof - Steinach - Eugen-Bolz-Schule Stadtrandlinie Bad Waldsee;;;Omnibus Müller;DE-BW-bodo;bod-8-337-1
33/8;bus;Bad Waldsee - Michelwinnaden - Bad Waldsee;;;Omnibus Müller;DE-BW-bodo;bod-8-338-1
34;bus;Ehrensberg - Molpertshaus - Mennisweiler - Bad Waldsee;;;Omnibus Müller;DE-BW-bodo;bod-8-034-1
@@route_id~^bod-8-
-

Next:

==== Lindau
@operator=Stadtwerke Lindau
- No routes match the filter criteria
@@operator=Stadtwerke Lindau
-

As I said, I can’t read German, but looking at the operator names that exist in the data, I’m guessing you meant one of these:

==== Lindau
@operator=Stadtverkehr Lindau
1;bus;Oberhochsteg - Anheggerstr (ZUP) Stadtbus Lindau;;;Stadtverkehr Lindau;DE-BW-bodo;bod-31-001-1
2;bus;Inselbahnhof - Anheggerstr. (ZUP) - Oberreitnau Stadtbus Lindau;;;Stadtverkehr Lindau;DE-BW-bodo;bod-31-002-1
3;bus;Gewerbegebiet - Anheggerstr. (ZUP) - Unterreitnau Stadtbus Lindau;;;Stadtverkehr Lindau;DE-BW-bodo;bod-31-003-1
4;bus;Rehlings/Weißensberg - Anheggerstr. (ZUP) - Alwind Stadtbus Lindau;;;Stadtverkehr Lindau;DE-BW-bodo;bod-31-004-1
5;bus;Inselbahnhof - Anheggerstr. (ZUP) - Grenzsiedlung/Zech Stadtbus Lindau;;;Stadtverkehr Lindau;DE-BW-bodo;bod-31-005-1
@@operator=Stadtverkehr Lindau

- or:
@operator=Stadtwerke Konstanz
Fähre;ferry;Fähre Meersburg - Konstanz-Staad;;;Stadtwerke Konstanz;DE-BW-bodo;nvb-4-0KN-1
@@operator=Stadtwerke Konstanz
-

Actually, judging from the title, definitely the first one.

Next one actually worked! :tada:

==== Regionalverkehr Bodenseekreis / Landkreis Ravensburg
@operator=Bühler
40;bus;Wilhelmsdorf - Riedhausen - Hoßkirch - Ostrach;;;Bühler;DE-BW-bodo;bod-2-040-1
41;bus;Wilhelmsdorf - Deggenhausertal;;;Bühler;DE-BW-bodo;bod-2-041-1
44;bus;Wilh.Pfrungen - Zußdorf - Esenhausen - Wilhelmsdorf;;;Bühler;DE-BW-bodo;bod-2-044-1
240;bus;Wilhelmsdorf - Altshausen;;;Bühler;DE-BW-bodo;bod-2-240-1
@@operator=Bühler
-

Next:

==== Ortsbus Immenstaad
@operator~Immenstaad
@ref~^7\d\d\d\D*$
- No routes match the filter criteria
@@operator~Immenstaad ref~^7\d\d\d\D*$
-

Seems like there’s no operator by that name. If I split to two separate filters I get:

==== Ortsbus Immenstaad
@operator~Immenstaad
- No routes match the filter criteria
@@operator~Immenstaad

@ref~^7\d\d\d\D*$
7376;bus;Schülerverkehr   Pfullendorf - Großschönach Herdwangen Üb-Rengoldshausen;;;BW;DE-BW-bodo;rab-14-376-1
7377;bus;Stockach Ludwigshafen Winterspüren Bonndorf - Hödingen - Aufkirch - Überlingen;;;BW;DE-BW-bodo;rab-14-377-1
7379;bus;LinzgauBus Heiligenberg - Frickingen - Owingen - Überlingen;;;BW;DE-BW-bodo;rab-14-379-1
7380;bus;Pfullendorf Hattenweiler Illmensee Heiligenberg;;;BW;DE-BW-bodo;rab-14-380-1
7381;bus;Wilhelmsdorf - Deggenhausertal - Salem - Überlingen;;;BW;DE-BW-bodo;rab-14-381-1
7382;bus;Ahausen - Bermatingen - Markdorf (Schülerverkehr);;;BW;DE-BW-bodo;rab-14-189-1
7382;bus;Meersburg Daisendorf Riedetsweiler Baitenhs. - Ahausen - Bermatingen - Markdorf;;;BW;DE-BW-bodo;rab-14-382-1
7383;bus;MuseumsBus   Meersburg - Daisendorf - Unteruhldingen;;;BW;DE-BW-bodo;rab-14-383-1
7384;bus;Deggenhausertal - Markdorf - Immenstaad;;;BW;DE-BW-bodo;rab-14-384-1
7385;bus;Wilhelmsdorf - Deggenhausertal;;;BW;DE-BW-bodo;rab-14-385-1
7386;bus;Hödingen Schloss Spetzgart Aufkirch Salem College Härlen - Überlingen;;;BW;DE-BW-bodo;rab-14-386-1
7389;bus;Stockach - Ludwigshafen - Überlingen;;;BW;DE-BW-bodo;rab-14-389-1
7392;bus;Überlingen-Owingen Pfullendorf Mahlspüren i. T.- Stockach;;;BW;DE-BW-bodo;rab-14-392-1
7394;bus;StädteSchnellbus (Spieleland -) Airport - Friedrichshafen - Meersburg - Konstanz;;;BW;DE-BW-bodo;rab-14-394-1
7395;bus;SeeLinie (Bodman -) Überlingen - Meersburg - Friedrichshafen;;;BW;DE-BW-bodo;rab-14-395-1
7396;bus;Frickingen - Salem - Markdorf - Immenstaad;;;BW;DE-BW-bodo;rab-14-396-1
7397;bus;LinzgauBus   Heiligenberg - Salem - Oberuhldingen (- Überlingen);;;BW;DE-BW-bodo;rab-14-397-1
7534;bus;Bad Wurzach -Wolfegg - Weingarten - Ravensburg;;;BW;DE-BW-bodo;rab-14-534-1
7535;bus;Wangen Wolfegg - Vogt - Waldburg - Schlier - Ravensburg;;;BW;DE-BW-bodo;rab-14-535-1
7537;bus;Meersburg - Markdorf - Oberteuringen - Ravensburg;;;BW;DE-BW-bodo;rab-14-537-1
7539;bus;7539 Esenhausen - Horgenzell - Ravensburg;;;BW;DE-BW-bodo;rab-14-539-1
7543;bus;Vogt Grund - Wolfegg - Kißlegg;;;BW;DE-BW-bodo;rab-14-543-1
7544;bus;Wangen - Allewinden - Kißlegg;;;BW;DE-BW-bodo;rab-14-544-1
7546;bus;Hiltensweiler - Unterlangnau - Laimnau - Tettnang;;;BW;DE-BW-bodo;rab-14-546-1
7547;bus;Wangen i.A. - Neukirch - Tettnang - Friedrichshafen;;;BW;DE-BW-bodo;rab-14-547-1
7549;bus;Bad Wurzach - Arnach - Kißlegg;;;Ehrmann Reisen GmbH & Co. KG;DE-BW-bodo;bod-3-549-1
7550;bus;Wangen (Allgäu) - Waltershofen - Kißlegg - Leutkirch;;;BW;DE-BW-bodo;rab-14-550-1
7551;bus;Isny - Leutkirch i. A.;;;BW;DE-BW-bodo;rab-14-551-1
7552;bus;Aichstetten - Aitrach - Bad Wurzach;;;BW;DE-BW-bodo;rab-14-552-1
7554;bus;Bad Waldsee - Aulendorf;;;BW;DE-BW-bodo;rab-14-554-1
7567;bus;Pfullendorf Aulendorf Bad Saulgau;;;BW;DE-BW-bodo;rab-14-567-1
7570;bus;(Herbertingen -) Bad Saulgau - Aulendorf;;;BW;DE-BW-bodo;rab-14-570-1
7571;bus;Leutkirch - Herlazhofen - Gebrazhofen - Leutkirch;;;BW;DE-BW-bodo;rab-14-571-1
7572;bus;Leutkich - Argenbühl/Eglofstal;;;BW;DE-BW-bodo;rab-14-572-1
7587;bus;(Lindau - Wasserburg -) Kressbronn - Friedrichshafen;;;BW;DE-BW-bodo;rab-14-587-1
@@ref~^7\d\d\d\D*$
-

So could you have meant the operator BW? (Does “BW” mean anything to you?)

The next three, you tried to filter by comment i.e. the route’s full name. If you meant that the name should contain these words, you should use ~ instead of =, which I tried and it only found one route:

==== Meersburg
@comment~Ortsbus Meersburg
1;bus;Ortsbus Meersburg BSB-Hafen-Töbele-Parkplatz Allmend-Daisendorf;;;BW;DE-BW-bodo;rab-14-810-1
@@comment~Ortsbus Meersburg
-

==== Kressbronn
@comment~Bürgerbus Kressbronn
- No routes match the filter criteria
@@comment~Bürgerbus Kressbronn
-

==== Aulendorf
@comment~Bürgerbus Aulendorf
- No routes match the filter criteria
@@comment~Bürgerbus Aulendorf
-

Last one:

==== Ravensburg/Weingarten
@operator~(Regionalverkehr Alb-Bodensee GmbH (RAB)|Omnibus Grabherr|Hagmann|Omnibus Müller)
@route_id~^(rab-14|4|bod-5|bod-8)$
- No routes match the filter criteria
@@operator~(Regionalverkehr Alb-Bodensee GmbH (RAB)|Omnibus Grabherr|Hagmann|Omnibus Müller) route_id~^(rab-14|4|bod-5|bod-8)$
-

Part of the reason this failed is that you ended the regex with $ meaning that has to be the end of the route_id. If you want the route_id to continue, drop the final $:

==== Ravensburg/Weingarten
@operator~(Regionalverkehr Alb-Bodensee GmbH \(RAB\)|Omnibus Grabherr|Hagmann|Omnibus Müller)
@route_id~^(rab-14|4|bod-5|bod-8)
20;bus;(Vorsee -) Wolpertswende - Weingarten - Ravensburg;;;Hagmann;DE-BW-bodo;bod-5-020-1
21;bus;Bodnegg - Grünkraut - Knollengraben - Ravensburg stadtbus Ravensburg Weingarten;;;Hagmann;DE-BW-bodo;bod-5-021-1
@@operator~(Regionalverkehr Alb-Bodensee GmbH \(RAB\)|Omnibus Grabherr|Hagmann|Omnibus Müller) route_id~^(rab-14|4|bod-5|bod-8)
-

There are a few more issues with this, but they’re things I already mentioned: no route_id starts with 4, the operator name for RAB seems to be just BW, and routes with route_id~^rab-14 were already added in a previous filter so can’t be added again.

Hope that points you in the right direction :slight_smile:

@ToniE to make tweaking filters more reasonable, would you be able to run the CSV injection code instantly when someone requests a new analysis, instead of just waiting for the analysis to start in the next 15-minute interval? An instant update in the wiki will go a long way to making tweaking filters more friendly.

This means the CSV injection code (+ wiki upload if diff) should run in all these scenarios: 1. GTFS post-analysis, after routes.json is created; 2. Instantly when a user requests a new analysis; 3. At the start of each analysis (for e.g. when users updated filters and didn’t manually request a new analysis).

Ok, I could try to support test, what would I have to do there

unfortunately not, just lines 861 + 862 from ‘Barnimer Busgesellschaft’ were served with trolleybusses

@ToniE and @mcliquid please see the edit to my previous comment in case you missed it.

Take a look at my instructions here: PTNA: news for Public Transport Network Analysis - #321 by NeatNit

1 Like

Yes, l can do so. I have to copy your code first and then implement the pre-analysis injection and upload part.

1 Like

Another approach which im going to implement:

Have a “Test injection code” button on the entry page of a GTFS feed.
This one reads the wiki page, injects the changes and presents the results in the browser.
Why in browser and not pushing result to wiki?

  • if the @-statements are not ok, then we should avoid creating another version in the wiki by injecting an undesired result.
  • if the @-statements are ok, then the wiki page is fine and the next logical step is to run a new analysis (request that in the report, will push injection result to wiki) showing whether the analysis result is also as expected.
1 Like

Sounds perfect.

I also considered outputting a comment line above each outputted route showing the hidden properties that are available for filtering, such as ‘internal’ and ‘catalog_number’ in Israel. This would make sense to show only in this “Test injection code” output, as it’s useful to see when editing filters but otherwise too verbose and spammy.

1 Like

Redesign: it will be a T-icon in the last column of the tables on the country-specific network analysis pages like PTNA - Results = link to the wiki pages. The T-icon will appear only if a corresponding “catalog” is available. It will trigger only the 2nd step, the actual injection. As said before, it will not push any data to the wiki, it will not trigger any analysis runs.

That sounds good. We can also add a link to the same place at the top of the wiki page, before <pre>, for convenience.

1 Like

Does the injection code allow writing to stdout, avoiding creation of a temporary file, piping this directly into PHP code.

I’ve tried to update the Template Test file with your latest comments and tips. How often does the updater run?

I can add that in.

Let’s actually keep these technical details in the private messages, it’s getting a bit spammy.

Right now, AFAIK only manually, unless Toni is farther along than I thought in automating it. But it will happen more frequently soon - Toni was just talking about adding an option to instantly check the results.

Please be patient, we might have started seeking testing volunteers a bit too early. There should be something a lot more usable to test within a few days.

1 Like

same here :wink:
regex is really the heaviest problem, but I’m thinking the most filters need only type and operator

Indeed, ideally equality and inequality filters would be sufficient, but often they are not enough. Use them as much as you can though!

There are plenty of resources online for getting to grips with regular expressions, and the most basic patterns will almost definitely be sufficient for these imports. Once you can handle ^ for the start and $ for the end of the string, you can probably make most filters you could ever need.

Do you create the 1.version of test template or have I to do this? (copy and edit the current VBB Linien ?)

Right, I’ll do it, one moment.

Edit: okay, I made it right here: Verkehrsverbund Berlin-Brandenburg/Analyse/DE-BE-VBB-Routes/Template test - OpenStreetMap Wiki I didn’t add any filters though. You can try copying some ones from Bodensee-Oberschwaben Verkehrsverbund/Analyse/DE-BW-bodo-Linien/Template Test - OpenStreetMap Wiki

1 Like