Changes between Version 38 and Version 39 of Rules/PublicTransportGtfs


Ignore:
Timestamp:
2022-02-08T13:39:46+01:00 (4 years ago)
Author:
skyper
Comment:

Transport vehicles are not needed on platforms, according to the wiki, and aare problematic together with highway=*; little shorter regexs

Legend:

Unmodified
Added
Removed
Modified
  • Rules/PublicTransportGtfs

    v38 v39  
    6363 */
    6464
    65 relation[type=route_master][route_master =~ /^(bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry|aerialway|school_bus|walking_bus)$/] {
     65relation[type=route_master][route_master =~ /bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry|aerialway|school_bus|walking_bus/] {
    6666  set PtRouteMaster;
    6767}
    6868/* Note: Only relations, routes on way are not supported  */
    69 relation[type=route              ][route        =~ /^(bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry|aerialway|school_bus|walking_bus)$/] {
     69relation[type=route              ][route        =~ /bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry|aerialway|school_bus|walking_bus/] {
    7070  set PtRoute;
    7171}
     
    7575}
    7676
    77 *[bus!=yes][coach!=yes][share_taxi!=yes][trolleybus!=yes][train!=yes][light_rail!=yes][subway!=yes][tram!=yes][monorail!=yes][funicular!=yes][ferry!=yes][!aerialway] {
     77*[/bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry/ =~ /yes|no/][!aerialway] {
     78  set PtVehicle;
     79}
     80
     81*[/bus|coach|share_taxi|trolleybus|train|light_rail|subway|tram|monorail|funicular|ferry/ !~ /yes/][!aerialway] {
    7882  set noPtVehicle;
    7983}
    8084
    81 *[public_transport =~ /^(platform|stop_area|stop_position)$/] {
     85*[public_transport =~ /platform|stop_area|stop_position/] {
    8286  set PtStop;
    8387}
     
    100104
    101105/* stop_area, stop_position, platform */
    102 *[public_transport =~ /^(platform|stop_position)$/][public_transport][!local_ref],
     106*[public_transport =~ /platform|stop_position/][public_transport][!local_ref],
    103107*.PtStop[public_transport][!network] {
    104108  throwWarning: tr("`{0}` without `{1}*`.", "{1.tag}", "{2.tag}");
     
    156160  assertNoMatch: "relation type=route route=train";
    157161  assertNoMatch: "relation type=route_master route_master=bus";
    158 
    159162}
    160163
     
    200203/* ToDo: Check against parent relation vehicle type */
    201204/* ToDo: Extend to check for parent relation value and offer fix */
    202 /* *[public_transport =~ /^(platform|stop_position)$/][highway!=bus_stop][public_transport].noPtVehicle { */
     205/* *[public_transport =~ /platform|stop_position/][highway!=bus_stop][public_transport].noPtVehicle { */
    203206/* needs check the other way around as access tags are problematic with ways */
    204 node[public_transport=stop_position][highway!=bus_stop].noPtVehicle {
     207node[public_transport=stop_position].noPtVehicle {
    205208  throwWarning: tr("`{0}` without serving vehicle type specified.", "{0.tag}");
    206209  group: tr("Public Transport GTFS: missing tag");
    207210  assertMatch:   "node public_transport=stop_position";
    208211  assertNoMatch: "node public_transport=stop_position bus=yes";
    209   assertNoMatch: "node public_transport=stop_position highway=bus_stop";
    210 }
    211 
    212 /* {0.tag} without any (info level) */
     212}
    213213
    214214/* platform */
    215 /* node[public_transport=platform][highway!=bus_stop].noPtVehicle {
    216   throwInfo: tr("`{0}` without serving vehicle type specified.", "{0.tag}");
    217   group: tr("Public Transport GTFS: missing tag");
    218   assertMatch:   "node public_transport=platform";
    219   assertNoMatch: "node public_transport=platform bus=yes";
    220   assertNoMatch: "node public_transport=platform highway=bus_stop";
    221 } */
     215/* access tags are only useful on stop_position */
     216area[public_transport=platform][highway].PtVehicle {
     217  throwWarning: tr("`Problematic access tag on {0} together with {1}. Only stop positions need it, according to the wiki.", "{0.tag}", "{1.tag}");
     218  group: tr("Public Transport GTFS: suspicious tag combination");
     219  assertMatch:   "way public_transport=platform highway=platform bus=yes";
     220  assertNoMatch: "way public_transport=platform bus=yes";
     221}
     222area[public_transport=platform][!highway].PtVehicle {
     223  throwWarning: tr("`Access tag on {0}. Only stop positions need it, according to the wiki.", "{0.tag}");
     224  group: tr("Public Transport GTFS: suspicious tag combination");
     225  assertMatch:   "way public_transport=platform bus=yes";
     226  assertNoMatch: "way public_transport=platform";
     227}
     228
     229/* {0.tag} with any (info level) */
     230
     231/* platform */
     232/* access tags are only useful on stop_position */
     233node[public_transport=platform].PtVehicle {
     234  throwOther: tr("`Serving vehicle type specified on {0}. Only stop positions need it, according to the wiki.", "{0.tag}");
     235  group: tr("Public Transport GTFS: suspicious tag combination");
     236  assertMatch:   "node public_transport=platform bus=yes";
     237  assertNoMatch: "node public_transport=platform";
     238}
    222239
    223240/* {0.tag} and {1.tag} without {2.key} (warning level) */
    224241
    225242/* stop_position, platform */
    226 node[public_transport=stop_position][train=yes][railway!=stop][public_transport],
    227 *[public_transport =~ /^(platform|stop_position)$/][train=yes][!ref][public_transport] {
    228   throwWarning: tr("`{0}` with `{1}` but without `{2}`.", "{3.tag}", "{1.tag}", "{2.tag}");
     243node[public_transport=stop_position][train=yes][railway!=stop],
     244node[public_transport=stop_position][train=yes][!ref],
     245*[public_transport=platform][railway=platform][!ref] {
     246  throwWarning: tr("`{0}` with `{1}` but without `{2}`.", "{0.tag}", "{1.tag}", "{2.tag}");
    229247  group: tr("Public Transport GTFS: missing tag");
    230248  assertMatch:   "node public_transport=stop_position train=yes railway=halt";
     
    235253
    236254/* platform */
    237 *[highway=bus_stop][public_transport =~ /^(platform|stop_position)$/][bus!=yes][share_taxi!=yes][trolleybus!=yes][public_transport] {
     255/*[highway=bus_stop][public_transport =~ /^(platform|stop_position)$/][bus!=yes][share_taxi!=yes][trolleybus!=yes][public_transport] {
    238256  throwWarning: tr("`{0}` with `{1}` but none of `{2}*`, `{3}*` or `{4}*`.", "{5.tag}", "{0.tag}", "{2.tag}", "{3.tag}", "{4.tag}");
    239257  group: tr("Public Transport GTFS: missing tag");
    240258  assertMatch:   "node public_transport=platform highway=bus_stop";
    241259  assertNoMatch: "node public_transport=platform highway=bus_stop bus=yes";
    242 }
     260} */
    243261
    244262/* One of many {0.key} but no {1.key} */
    245263
    246264/* gtfs:release_date */
    247 *[/(^gtfs:|:gtfs|^ref:IFOPT)/][!gtfs:release_date] {
     265*[/(^gtfs:.+|.+:gtfs|^ref:IFOPT)$/][!gtfs:release_date] {
    248266  throwWarning: tr("GTFS tag without `{0}*`.", "{1.tag}");
    249267  group: tr("Public Transport GTFS: missing tag");
     
    252270  assertMatch:   "node ref:IFOPT=1";
    253271  assertNoMatch: "node ref:IFOPT=1 gtfs:release_date=2019";
    254 } 
     272}
    255273
    256274/*  -----------------------
    257  *  value syntax 
     275 *  value syntax
    258276 */
    259277
    260278/* route_id, shape_id, trip_id */
    261 /* FIXME: Split checks per feed instead of one global regex.
     279/* FIXME: Split checks per feed instead of one global regex. */
    262280/* FIXME: Get proper syntax as regex displayed. */
    263281*[gtfs:route_id      ][gtfs:route_id       !~                           /^[0-9]{1,2}-[A-Z]?[0-9]{1,3}[A-Z]?(-[0-9A-Z])?-[js]?[1-9][0-9j]a?-[0-9]+(;[ ]?[0-9]{1,2}-[A-Z]?[0-9]{1,3}[A-Z]?(-[0-9A-Z])?-[js]?[1-9][0-9j]a?-[0-9]+)*$/],
     
    293311*[network:guid ][network:guid  !~ /^(([A-Z]{2}-){2}[a-zA-Z]{2}.*|[A-Z]{2}-Flixbus|BO-C-Cochabamba|(CH|LU)-[a-zA-Z]{3,}|CO-BOY-[A-Z].+|ES-AR-Z-[A-Z].+|FR-IDF-(r|[a-zA-Z]{3,}.*)|MG-T-Antananarivo)$/],
    294312*[operator:guid][operator:guid !~ /^(([A-Z]{2}-){2}[a-zA-Z]{2}.*|[A-Z]{2}-Flixbus|BO-C-Cochabamba|(CH|LU)-[a-zA-Z]{3,}|CO-BOY-[A-Z].+|ES-AR-Z-[A-Z].+|FR-IDF-(r|[a-zA-Z]{3,}.*)|MG-T-Antananarivo)$/],
    295 *[gtfs:release_date][gtfs:release_date !~ /^20(1[7-9]|2[0-2])-(0[1-9]|1[0-2])-(3[01]|[12][0-9]|0[1-9])$/] {
     313*[gtfs:release_date][gtfs:release_date !~ /^20(1[89]|2[0-2])-(0[1-9]|1[0-2])-(3[01]|[12][0-9]|0[1-9])$/] {
    296314  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax.", "{0.value}", "{0.key}");
    297315/*  throwError: tr("Value `{0}` for `{1}=*` does not match value syntax `{2}`.", "{0.value}", "{0.key}", "{1.value}"); */
     
    352370
    353371/* short ref:IFOPT */
    354 node[public_transport=stop_position][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT        !~ /^.+(:.+){4}$/],
    355 node[public_transport=stop_position][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/],
    356 node[public_transport=platform     ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT        !~ /^.+(:.+){4}$/],
    357 node[public_transport=platform     ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id     !~ /^.+(:.+){4}$/],
    358 way[public_transport=platform      ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT         !~ /^.+(:.+){3}$/],
    359 way[public_transport=platform      ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id      !~ /^.+(:.+){3}$/],
     372node[public_transport=stop_position][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){4}$/],
     373node[public_transport=stop_position][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/],
     374node[public_transport=platform     ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){4}$/],
     375node[public_transport=platform     ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/],
     376way[public_transport=platform      ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){3}$/],
     377way[public_transport=platform      ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/],
    360378relation[public_transport=platform ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){3}$/],
    361379relation[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){3}$/] {
     
    368386  assertNoMatch: "relation public_transport=platform ref:IFOPT=de:09162:1179:30";
    369387}
    370 way[public_transport=platform      ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT         !~ /^.+(:.+){4}$/],
    371 way[public_transport=platform      ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id      !~ /^.+(:.+){4}$/],
     388way[public_transport=platform      ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){4}$/],
     389way[public_transport=platform      ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/],
    372390relation[public_transport=platform ][ref:IFOPT   ]!.ErrorSyntaxIFOPT[ref:IFOPT    !~ /^.+(:.+){4}$/],
    373391relation[public_transport=platform ][gtfs:stop_id]!.ErrorSyntaxIFOPT[gtfs:stop_id !~ /^.+(:.+){4}$/],
     
    413431/* Permanet links to PTNA GTFS */
    414432/* *[JOSM_search("ptna.openstreetmap.de/gtfs")][!JOSM_search("^.*network=([a-zA-Z]+[-]){2,}\\d{4}(-\\d\\d){2}.*$")] { */
    415 *[url     =~ /^.*ptna\.openstreetmap\.de\/gtfs.+$/][url     !~ /^.*(network=([a-zA-Z]+[-]){2,}|release_date=)\d{4}(-\d\d){2}.*$/],
    416 *[website =~ /^.*ptna\.openstreetmap\.de\/gtfs.+$/][website !~ /^.*(network=([a-zA-Z]+[-]){2,}|release_date=)\d{4}(-\d\d){2}.*$/],
    417 *[source  =~ /^.*ptna\.openstreetmap\.de\/gtfs.+$/][source  !~ /^.*(network=([a-zA-Z]+[-]){2,}|release_date=)\d{4}(-\d\d){2}.*$/] {
     433*[url     =~ /.*ptna\.openstreetmap\.de\/gtfs.+/][url     !~ /.*(network=([a-zA-Z]+[-]){2,}|release_date=)\d{4}(-\d\d){2}.*/],
     434*[website =~ /.*ptna\.openstreetmap\.de\/gtfs.+/][website !~ /.*(network=([a-zA-Z]+[-]){2,}|release_date=)\d{4}(-\d\d){2}.*/],
     435*[source  =~ /.*ptna\.openstreetmap\.de\/gtfs.+/][source  !~ /.*(network=([a-zA-Z]+[-]){2,}|release_date=)\d{4}(-\d\d){2}.*/] {
    418436  throwWarning: tr("Relative GTFS url in `{0}=*`. Add `{1}` behind the feed or network value.", "{0.key}", "&release_date=*");
    419437  assertMatch:   "node source=\"https://ptna.openstreetmap.de/gtfs/19\"";
     
    427445
    428446/* ref:IFOPT, gtfs:stop_id, local_ref */
    429 /* *[public_transport][public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.+:){4}([A-Z]+[ ]?)?([1-9][0-9]{0,2}[A-Z]?)", tag("ref:IFOPT")), 3))][local_ref][ref:IFOPT], */
    430 /* *[public_transport][public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.+:){4}([A-Z]+[ ]?)?([1-9][0-9]{0,2}[A-Z]?)", tag("gtfs:stop_id")), 3))][local_ref][ref:IFOPT] { */
    431 *[local_ref][ref:IFOPT]!.ErrorSyntaxIFOPT[public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.+:){4}(.+)", tag("ref:IFOPT")), 2))],
    432 *[local_ref][ref:IFOPT]!.ErrorSyntaxIFOPT[public_transport =~ /^(platform|stop_position)$/][!(tag("local_ref") == get(regexp_match("^(.+:){4}(.+)", tag("gtfs:stop_id")), 2))] {
     447/* *[public_transport][public_transport =~ /platform|stop_position/][!(tag("local_ref") == get(regexp_match("^(.+:){4}([A-Z]+[ ]?)?([1-9][0-9]{0,2}[A-Z]?)", tag("ref:IFOPT")), 3))][local_ref][ref:IFOPT], */
     448/* *[public_transport][public_transport =~ /platform|stop_position)][!(tag("local_ref") == get(regexp_match("^(.+:){4}([A-Z]+[ ]?)?([1-9][0-9]{0,2}[A-Z]?)", tag("gtfs:stop_id")), 3))][local_ref][ref:IFOPT] { */
     449*[local_ref][ref:IFOPT]!.ErrorSyntaxIFOPT[public_transport =~ /platform|stop_position/][!(tag("local_ref") == get(regexp_match("^(.+:){4}(.+)", tag("ref:IFOPT")), 2))],
     450*[local_ref][ref:IFOPT]!.ErrorSyntaxIFOPT[public_transport =~ /platform|stop_position/][!(tag("local_ref") == get(regexp_match("^(.+:){4}(.+)", tag("gtfs:stop_id")), 2))] {
    433451  throwWarning:  tr("`{0}` conflicts with `{1}`.", "{0.tag}", "{1.tag}");
    434452  group: tr("Public Transport GTFS: conflicting tags");
     
    454472*[gtfs:shape_id][gtfs:trip_id       ]!.MultipleID!.GtfsIdSyntax[!(tag("gtfs:shape_id") == get(regexp_match("^[1-9][0-9]{0,3}\\.T[023A]\\.(.+)$", tag("gtfs:trip_id")), 1))],
    455473*[gtfs:shape_id][gtfs:trip_id:sample]!.MultipleID!.GtfsIdSyntax[!(tag("gtfs:shape_id") == get(regexp_match("^[1-9][0-9]{0,3}\\.T[023A]\\.(.+)$", tag("gtfs:trip_id:sample")), 1))] {
    456   throwError: tr("`{1}` is not a substring of `{0}`.", "{0.tag}", "{1.tag}"); 
     474  throwError: tr("`{1}` is not a substring of `{0}`.", "{0.tag}", "{1.tag}");
    457475  group: tr("Public Transport GTFS: conflicting tags");
    458476  assertMatch:   "relation gtfs:route_id=7-342-j1j-1 gtfs:shape_id=7-352-j1j-1.17.H";