Ticket #24476: validate_tree_dimensions.patch

File validate_tree_dimensions.patch, 2.3 KB (added by tordanik, 7 months ago)
  • resources/data/validator/numeric.mapcss

    diff --git a/resources/data/validator/numeric.mapcss b/resources/data/validator/numeric.mapcss
    index ff190dd326..20ceacb9e3 100644
    a b node[natural=tree][circumference][siunit_length(tag(circumference)) > 45] {  
    672672  assertNoMatch: "node natural=tree circumference=\"100 cm\"";
    673673  assertNoMatch: "node natural=tree circumference=43"; /* Current world record */
    674674}
     675
     676node[natural=tree][height][siunit_length(tag(height)) > 150] {
     677  throwWarning: tr("Unusually large value of {0} for a tree.", "{1.key}");
     678  assertMatch: "node natural=tree height=\"200 m\"";
     679  assertMatch: "node natural=tree height=3100.0";
     680  assertNoMatch: "node natural=tree height=9.7";
     681  assertNoMatch: "node natural=tree height=\"5900 cm\"";
     682  assertNoMatch: "node natural=tree height=116 m"; /* Current world record "Hyperion" */
     683}
     684
     685node[natural=tree][diameter][diameter =~ /^-?[0-9]+(\.[0-9]+)?$/][diameter < 5] {
     686  throwWarning: tr("Unusually small value of {0} for a tree. Values for {0} without explicit unit are in millimeters.", "{1.key}");
     687  assertMatch: "node natural=tree diameter=2";
     688  assertNoMatch: "node natural=tree diameter=2 m";
     689  assertNoMatch: "node natural=tree diameter=1000.0";
     690}
     691
     692node[natural=tree][diameter][diameter =~ /^[0-9]+(\.[0-9]+)?$/][diameter > 20000] { /* special case because siunit_length for unitless values */
     693  throwWarning: tr("Unusually large value of {0} for a tree''s trunk. Use diameter_crown for crown diameter.", "{1.key}");
     694  assertMatch: "node natural=tree diameter=44000.0";
     695  assertNoMatch: "node natural=tree diameter=15900"; /* Current world record "Glencoe Baobab" */
     696}
     697
     698node[natural=tree][diameter][diameter =~ /m/][siunit_length(tag(diameter)) > 20] {
     699  throwWarning: tr("Unusually large value of {0} for a tree''s trunk. Use diameter_crown for crown diameter.", "{1.key}");
     700  assertMatch: "node natural=tree diameter=\"25 m\"";
     701  assertNoMatch: "node natural=tree diameter=15.9 m"; /* Current world record "Glencoe Baobab" */
     702}
     703
     704node[natural=tree][diameter_crown][siunit_length(tag(diameter_crown)) > 100] {
     705  throwWarning: tr("Unusually large value of {0} for a tree.", "{1.key}");
     706  assertMatch: "node natural=tree diameter_crown=\"121.2 m\"";
     707  assertNoMatch: "node natural=tree diameter_crown=80 m";
     708}
     709 No newline at end of file