| Version 5 (modified by , 6 years ago) ( diff ) |
|---|
Public Transport GTFS
These rules add additional checks for public transportation tagging. One major part are tags in use with GTFS and PTNA. See Public Transport GTFS preset for a corresponding preset.
Help needed
Please, feel free to:
- enhance and update the preset
- translate at Launchpad
- create a nice icon.
- write me an email
Notes
- Really beta so far and under development. Expect false positives and lots of changes.
- The tagging schema is still under heavy development and therefore the rules might change quite often.
Supported Tags
Value syntax check
- ref:IFOPT
- gtfs:stop_id
- network:guid
- operator:guid
- gtfs:feed
- gtfs:route_id
- gtfs:shape_id
- gtfs:trip_id (no page, yet)
- gtfs:trip_id:sample (no page, yet)
- gtfs:source_date (no page, yet)
Rules source code
meta { title: "Public Transport GTFS"; link: "https://josm.openstreetmap.de/wiki/Rules/PublicTransportGtfs"; description: "Special rules for Public transportation supporting GTFS and tags for PTNA"; author: "skyper"; baselanguage: "en"; version: "0.0.43_2025-01-03"; } /* value syntax */ /* FIXME: Get proper syntax as regex displayed. /* ref:IFOPT, gtfs:stop_id, route/shape/trip_id */ *[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]?$/], *[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]$/], *[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]$/], *[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]$/], *[gtfs:feed][gtfs:feed !~ /^(([A-Z]{2}-){2}[a-zA-Z]{2}.*|DE-SPNV|DE-S-und-U-Bahnen|DK-Alle)$/], *[network:guid][network:guid !~ /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/], *[operator:guid][operator:guid !~ /^([A-Z]{2}-){2}[a-zA-Z]{2}.*$/], *[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])$/], *[ref:IFOPT][ref:IFOPT !~ /^[a-z]{2}:[0-9]{5}:[1-9][0-9]{0,4}(:[0-9]{1,2}(:[1-9][0-9]?)?)?$/], *[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]?)?)?$/] { /* throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`", "{0.value}", "{0.key}", "{1.value}"); */ throwError: tr("Value `{0}` for `{1}=*` does not match value syntax", "{0.value}", "{0.key}"); group: tr("Public Transport GTFS"); assertMatch: "relation gtfs:route_id=7-342-j1j-1.H"; assertNoMatch: "relation gtfs:route_id=7-342-j1j-1"; assertNoMatch: "relation gtfs:route_id=90-742-B-j20-1"; assertNoMatch: "relation gtfs:route_id=10-11-I-j20-1"; assertMatch: "relation gtfs:shape_id=11-4-I-j20-1.23."; assertNoMatch: "relation gtfs:shape_id=11-4-I-j20-1.23.H"; assertNoMatch: "relation gtfs:shape_id=7-342-j1j-1.51.R"; assertMatch: "relation gtfs:trip_id=1108.T2.11-4-I-j20-1.10."; assertNoMatch: "relation gtfs:trip_id=1108.T2.11-4-I-j20-1.10.H"; assertNoMatch: "relation gtfs:trip_id=29.T0.7-342-j1j-1.50.H"; assertNoMatch: "relation gtfs:trip_id=2.TA.90-742-B-j20-1.4.R"; assertMatch: "relation gtfs:feed=DE-SH.NAH"; assertNoMatch: "relation gtfs:feed=df-SL-saarVV"; assertNoMatch: "relation gtfs:feed=DE-SH-NAH.SH"; assertNoMatch: "relation gtfs:feed=DE-BY-VVM-Mittelschwaben"; assertNoMatch: "relation gtfs:feed=DE-SL-saarVV"; assertMatch: "relation gtfs:source_date=2016-09-30"; assertMatch: "relation gtfs:source_date=2020-9-3"; assertMatch: "relation gtfs:source_date=2016-09-30"; assertNoMatch: "relation gtfs:source_date=2020-09-30"; assertMatch: "node ref:IFOPT=+1"; assertMatch: "node ref:IFOPT=aa:aa:09"; assertMatch: "node ref:IFOPT=ch:3001:64883"; assertNoMatch: "node ref:IFOPT=ch:23001:64883"; assertNoMatch: "node ref:IFOPT=de:08315:6504:0:14"; assertNoMatch: "node ref:IFOPT=ch:23005:6"; assertNoMatch: "node gtfs:stop_id=ch:3001:64883"; } /* ---------------- * conflicting tags */ /* route_id, shape_id, trip_id */ *[gtfs:route_id][gtfs:shape_id][!(tag("gtfs:route_id") == get(regexp_match("^(.+)\\.[1-9][0-9]?\\.[HR]$", tag("gtfs:shape_id"), "d"), 1))], *[gtfs:route_id][gtfs:trip_id][!(tag("gtfs:route_id") == get(regexp_match("^[1-9][0-9]{0,3}\\.T[023A]\\.(.+)\\.[1-9][0-9]?\\.[HR]$", tag("gtfs:trip_id")), 1))], *[gtfs:route_id][gtfs:trip_id:sample][!(tag("gtfs:route_id") == get(regexp_match("^[1-9][0-9]{0,3}\\.T[023A]\\.(.+)\\.[1-9][0-9]?\\.[HR]$", tag("gtfs:trip_id:sample")), 1))] { throwError: tr("`{1}` is not a substring of `{0}`", "{0.tag}", "{1.tag}"); group: tr("Public Transport GTFS"); assertMatch: "relation gtfs:route_id=7-342-j1j-1 gtfs:shape_id=7-342-j1j-1"; assertMatch: "relation gtfs:route_id=7-342-j1j-1 gtfs:shape_id=7-352-j1j-1.17.H"; assertMatch: "relation gtfs:route_id=7-342-j1j-1 gtfs:shape_id=T7-342-j1j-1.17.H"; assertNoMatch: "relation gtfs:route_id=7-342-j1j-1 gtfs:shape_id=7-342-j1j-1.17.H"; assertMatch: "relation gtfs:route_id=11-4-I-j20-1 gtfs:trip_id=1108.T2.11-4-I-j20-1.10."; assertMatch: "relation gtfs:route_id=11-4-I-j20-1 gtfs:trip_id=1108.T2.11-5-I-j20-1.10.H"; assertMatch: "relation gtfs:route_id=11-4-I-j20-1 gtfs:trip_id=1108.TB2.11-5-I-j20-1.10.H"; assertNoMatch: "relation gtfs:route_id=11-4-I-j20-1 gtfs:trip_id=1108.T2.11-4-I-j20-1.10.H"; }
Rules_PublicTransportGtfs.validator.mapcss, Rules_PublicTransportGtfs.zip
Note:
See TracWiki
for help on using the wiki.


