Changeset 17953 in josm for trunk/resources


Ignore:
Timestamp:
2021-07-07T21:45:42+02:00 (3 years ago)
Author:
Klumbumbus
Message:

fix #21068 - Add validator rules for roof:height (patch by skyper)

Location:
trunk/resources/data/validator
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/resources/data/validator/combinations.mapcss

    r17923 r17953  
    345345}
    346346
    347 /* only {0.key}, #11104, #12422, #14950, #19572 */
    348 *[lanes][eval(number_of_tags()) = 1],
    349 *[surface][eval(number_of_tags()) = 1],
    350 *[access][eval(number_of_tags()) = 1],
    351 *[area][eval(number_of_tags()) = 1]!.area_yes_autofix,
    352 *[name][eval(number_of_tags()) = 1],
    353 *[ref][eval(number_of_tags()) = 1],
    354 *[lit][eval(number_of_tags()) = 1] {
     347/* only {0.key}, #11104, #12422, #14950, #19572, #20902 */
     348/* relations excluded as there is a test for missing type=* plus several other test depending on the type exist */
     349node[access][eval(number_of_tags()) = 1],
     350way[access][eval(number_of_tags()) = 1],
     351node[area][eval(number_of_tags()) = 1]!.area_yes_autofix,
     352way[area][eval(number_of_tags()) = 1]!.area_yes_autofix,
     353node[lanes][eval(number_of_tags()) = 1],
     354way[lanes][eval(number_of_tags()) = 1],
     355node[layer][eval(number_of_tags()) = 1],
     356way[layer][eval(number_of_tags()) = 1],
     357way[level][eval(number_of_tags()) = 1], /* nodes might be valid, e.g. start and end nodes of steps */
     358node[lit][eval(number_of_tags()) = 1],
     359way[lit][eval(number_of_tags()) = 1],
     360node[name][eval(number_of_tags()) = 1],
     361way[name][eval(number_of_tags()) = 1],
     362node[ref][eval(number_of_tags()) = 1],
     363way[ref][eval(number_of_tags()) = 1],
     364node[surface][eval(number_of_tags()) = 1],
     365way[surface][eval(number_of_tags()) = 1] {
    355366  throwWarning: tr("incomplete object: only {0}", "{0.key}");
    356367  set only_one_tag;
     
    364375}
    365376/* only {0.tag}, #15269 */
    366 *[tourism=attraction][eval(number_of_tags()) = 1] {
     377node[tourism=attraction][eval(number_of_tags()) = 1],
     378way[tourism=attraction][eval(number_of_tags()) = 1] {
    367379  throwWarning: tr("incomplete object: only {0}", "{0.tag}");
    368380  group: tr("missing tag");
  • trunk/resources/data/validator/numeric.mapcss

    r17939 r17953  
    134134}
    135135
     136*[roof:height][roof:height =~ /^0*(\.0*)?( (m|ft))?$/][roof:shape=flat] {
     137  throwWarning: tr("{0} is unnecessary for {1}", "{0.tag}", "{2.tag}");
     138  group: tr("unnecessary tag");
     139  fixRemove: "{0.key}";
     140  set zero_roof_height_flat;
     141  assertMatch: "node roof:height=0 roof:shape=flat";
     142  assertMatch: "node roof:shape=flat roof:height=\"00.00000 ft\" roof:shape=flat";
     143  assertNoMatch: "node roof:shape=flat roof:height=2 m roof:shape=flat";
     144  assertNoMatch: "node roof:height=0 roof:shape=gabled";
     145}
     146*[roof:height][roof:height =~ /^[0-9]+(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/]!.zero_roof_height_flat {
     147  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     148  set roof_height_meter_autofix;
     149  fixAdd: concat("roof:height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("roof:height")),1)," m");
     150  assertMatch: "node roof:height=6.78 meters";
     151  assertMatch: "node roof:height=5  metre";
     152  assertMatch: "node roof:height=2m";
     153  assertNoMatch: "node roof:height=2 m";
     154  assertNoMatch: "node roof:height=5";
     155}
     156*[roof:height][roof:height =~ /^[0-9]+(\.[0-9]+)?(( )*(foot|Foot|feet|Feet)|ft)$/]!.zero_roof_height_flat {
     157  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     158  set roof_height_foot_autofix;
     159  fixAdd: concat("roof:height=", get(regexp_match("([0-9.]+)( )*(.+)",tag("roof:height")),1)," ft");
     160  assertMatch: "node roof:height=6.78 foot";
     161  assertMatch: "node roof:height=5  Feet";
     162  assertMatch: "node roof:height=2ft";
     163  assertNoMatch: "node roof:height=2 ft";
     164  assertNoMatch: "node roof:height=5";
     165}
     166*[roof:height][roof:height =~ /^[0-9]+,[0-9][0-9]?( (m|ft))?$/] {
     167  throwWarning: tr("unusual value of {0}: use . instead of , as decimal separator", "{0.key}");
     168  fixAdd: concat("roof:height=", replace(tag("roof:height"), ",", "."));
     169  set roof_height_separator_autofix;
     170  assertMatch: "node roof:height=5,5";
     171  assertMatch: "node roof:height=12,00";
     172  assertMatch: "node roof:height=12,5 ft";
     173  assertNoMatch: "node roof:height=12,000";
     174  assertNoMatch: "node roof:height=3,50,5";
     175  assertNoMatch: "node roof:height=3.5";
     176  assertNoMatch: "node roof:height=4";
     177}
     178
    136179*[maxlength][maxlength =~ /^[1-9][0-9]*(\.[0-9]+)?(( )*(metre|metres|meter|meters|Metre|Metres|Meter|Meters)|m)$/] {
    137180  throwWarning: tr("unusual value of {0}: use abbreviation for unit and space between value and unit", "{0.key}");
     
    231274}
    232275
    233 *[height      ][height !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.height_separator_autofix!.height_meter_autofix!.height_foot_autofix,
    234 *[maxheight][maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default|below_default)$/]!.maxheight_separator_autofix!.maxheight_meter_autofix!.maxheight_foot_autofix,
    235 *[maxlength][maxlength !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default|below_default)$/]!.maxlength_separator_autofix!.maxlength_meter_autofix!.maxlength_foot_autofix,
    236 *[width        ][width !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.width_separator_autofix!.width_meter_autofix!.width_foot_autofix,
    237 *[maxwidth  ][maxwidth !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.maxwidth_separator_autofix!.maxwidth_meter_autofix!.maxwidth_foot_autofix {
     276*[height     ][height      !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.height_separator_autofix!.height_meter_autofix!.height_foot_autofix,
     277*[maxheight  ][maxheight   !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default|below_default)$/]!.maxheight_separator_autofix!.maxheight_meter_autofix!.maxheight_foot_autofix,
     278*[roof:height][roof:height !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/]!.roof_height_separator_autofix!.roof_height_meter_autofix!.roof_height_foot_autofix!.zero_roof_height_flat,
     279*[maxlength  ][maxlength   !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?)|none|default|below_default)$/]!.maxlength_separator_autofix!.maxlength_meter_autofix!.maxlength_foot_autofix,
     280*[width      ][width       !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.width_separator_autofix!.width_meter_autofix!.width_foot_autofix,
     281*[maxwidth   ][maxwidth    !~ /^(([0-9]+(\.[0-9]+)?( (m|ft))?)|([0-9]+\'([0-9]+(\.[0-9]+)?\")?))$/]!.maxwidth_separator_autofix!.maxwidth_meter_autofix!.maxwidth_foot_autofix {
    238282  throwWarning: tr("unusual value of {0}: {1} is default; only positive values; point is decimal separator; if units, put space then unit", "{0.key}", "meters");
    239283  assertMatch: "node height=medium";
Note: See TracChangeset for help on using the changeset viewer.