| | 1 | = Public Transport GTFS |
| | 2 | These rules add additional checks for public transportation tagging. One major part are tags in use with [osmwiki:General_Transit_Feed_Specification GTFS] and [https://ptna.openstreetmap.de/ PTNA]. See [wikitr:/Presets/PublicTransportGtfs Public Transport GTFS preset] for a corresponding preset. |
| | 3 | |
| | 4 | == Help needed |
| | 5 | Please, feel free to: |
| | 6 | * enhance and update the preset |
| | 7 | * translate at [https://translations.launchpad.net/josm/trunk/ Launchpad] |
| | 8 | * create a nice icon. |
| | 9 | * write me an [osmwww:message/new/skyper email] |
| | 10 | |
| | 11 | == Notes |
| | 12 | * Really beta so far and under development. Expect false positives and lots of changes. |
| | 13 | * The tagging schema is still under heavy development and therefore the rules might change quite often. |
| | 14 | |
| | 15 | == Supported Tags |
| | 16 | === Value syntax check |
| | 17 | * [osmwiki:Key:ref:IFOPT ref:IFOPT] |
| | 18 | * [osmwiki:Key:gtfs:stop_id gtfs:stop_id] |
| | 19 | * [osmwiki:Key:network:guid network:guid] |
| | 20 | * [osmwiki:Proposed_features/Key:operator:guid operator:guid] |
| | 21 | * [osmwiki:Proposed_features/Key:gtfs:feed gtfs:feed] |
| | 22 | * [osmwiki:Proposed_features/Key:gtfs:route_id gtfs:route_id] |
| | 23 | * [osmwiki:Proposed_features/Key:gtfs:shape_id gtfs:shape_id] |
| | 24 | * [osmwiki:Proposed_features/Key:gtfs:trip_id gtfs:trip_id] ''(no page, yet)'' |
| | 25 | * [osmwiki:Proposed_features/Key:gtfs:trip_id:sample gtfs:trip_id:sample] ''(no page, yet)'' |
| | 26 | * [osmwiki:Proposed_features/Key:gtfs:source_date gtfs:source_date] ''(no page, yet)'' |
| | 27 | |
| | 28 | == Rules source code == #SourceCode |
| | 29 | {{{ |
| | 30 | #!rule |
| | 31 | /* value syntax */ |
| | 32 | |
| | 33 | /* FIXME: Get proper syntax as regex displayed. |
| | 34 | /* ref:IFOPT, gtfs:stop_id, route/shape/trip_id */ |
| | 35 | *[gtfs:route_id][gtfs:route_id !~ /^[1-9][0-9]?-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?$/], |
| | 36 | *[gtfs:shape_id][gtfs:shape_id !~ /^[1-9][0-9]?-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR]$/], |
| | 37 | *[gtfs:trip_id][gtfs:trip_id !~ /^[1-9][0-9]{0,3}\.T[023A]\.[1-9][0-9]?-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR]$/], |
| | 38 | *[gtfs:trip_id:sample][gtfs:trip_id:sample !~ /^[1-9][0-9]{0,3}\.T[023A]\.[1-9][0-9]?-[1-9][0-9]{0,2}(-[A-Z])?-j[1-9][0-9j]-[1-9][0-9]?\.[1-9][0-9]?\.[HR]$/], |
| | 39 | *[gtfs:feed][gtfs:feed !~ /^(([A-Z]{2}-){2}[a-zA-Z]{2}.*|DE-SPNV|DE-S-und-U-Bahnen|DK-Alle)$/], |
| | 40 | *[network:guid][network:guid !~ /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/], |
| | 41 | *[operator:guid][operator:guid !~ /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/], |
| | 42 | *[gtfs:source_date][gtfs:source_date !~ /^20(1[7-9]|20)-(0[1-9]|1[0-2])-(3[01]|[12][0-9]|0[1-9])$/], |
| | 43 | *[ref:IFOPT][ref:IFOPT !~ /^[a-z]{2}:[0-9]{5}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:[1-9][0-9]?)?)?$/], |
| | 44 | *[gtfs:stop_id][gtfs:stop_id !~ /^[a-z]{2}:[0-9]{4,5}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:[1-9][0-9]?)?)?$/] { |
| | 45 | /* throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`", "{0.value}", "{0.key}", "{1.value}"); */ |
| | 46 | throwError: tr("Value `{0}` for `{1}=*` does not match value syntax", "{0.value}", "{0.key}"); |
| | 47 | group: tr("Public Transport GTFS"); |
| | 48 | assertMatch: "relation gtfs:route_id=7-342-j1j-1.H"; |
| | 49 | assertNoMatch: "relation gtfs:route_id=7-342-j1j-1"; |
| | 50 | assertNoMatch: "relation gtfs:route_id=90-742-B-j20-1"; |
| | 51 | assertNoMatch: "relation gtfs:route_id=10-11-I-j20-1"; |
| | 52 | assertMatch: "relation gtfs:shape_id=11-4-I-j20-1.23."; |
| | 53 | assertNoMatch: "relation gtfs:shape_id=11-4-I-j20-1.23.H"; |
| | 54 | assertNoMatch: "relation gtfs:shape_id=7-342-j1j-1.51.R"; |
| | 55 | assertMatch: "relation gtfs:trip_id=1108.T2.11-4-I-j20-1.10."; |
| | 56 | assertNoMatch: "relation gtfs:trip_id=1108.T2.11-4-I-j20-1.10.H"; |
| | 57 | assertNoMatch: "relation gtfs:trip_id=29.T0.7-342-j1j-1.50.H"; |
| | 58 | assertNoMatch: "relation gtfs:trip_id=2.TA.90-742-B-j20-1.4.R"; |
| | 59 | assertMatch: "relation gtfs:feed=DE-SH.NAH"; |
| | 60 | assertNoMatch: "relation gtfs:feed=df-SL-saarVV"; |
| | 61 | assertNoMatch: "relation gtfs:feed=DE-SH-NAH.SH"; |
| | 62 | assertNoMatch: "relation gtfs:feed=DE-BY-VVM-Mittelschwaben"; |
| | 63 | assertNoMatch: "relation gtfs:feed=DE-SL-saarVV"; |
| | 64 | assertMatch: "relation gtfs:source_date=2016-09-30"; |
| | 65 | assertMatch: "relation gtfs:source_date=2020-9-3"; |
| | 66 | assertMatch: "relation gtfs:source_date=2016-09-30"; |
| | 67 | assertNoMatch: "relation gtfs:source_date=2020-09-30"; |
| | 68 | assertMatch: "node ref:IFOPT=+1"; |
| | 69 | assertMatch: "node ref:IFOPT=aa:aa:09"; |
| | 70 | assertMatch: "node ref:IFOPT=ch:3001:64883"; |
| | 71 | assertNoMatch: "node ref:IFOPT=ch:23001:64883"; |
| | 72 | assertNoMatch: "node ref:IFOPT=de:08315:6504:0:14"; |
| | 73 | assertNoMatch: "node ref:IFOPT=ch:23005:6"; |
| | 74 | assertNoMatch: "node gtfs:stop_id=ch:3001:64883"; |
| | 75 | } |