| 595 | } |
| 596 | |
| 597 | string DetermineSurfaceAndHighwayType(OsmElement * p) |
| 598 | { |
| 599 | string surface; |
| 600 | string smoothness; |
| 601 | double surfaceGrade = 2; // default is "normal" |
| 602 | string highway; |
| 603 | string trackGrade; |
| 604 | |
| 605 | for (auto const & tag : p->m_tags) |
| 606 | if (tag.m_key == "surface") |
| 607 | surface = tag.m_value; |
| 608 | else if (tag.m_key == "smoothness") |
| 609 | smoothness = tag.m_value; |
| 610 | else if (tag.m_key == "surface:grade") // discouraged, 25k usages as of 2024 |
| 611 | (void)strings::to_double(tag.m_value, surfaceGrade); |
| 612 | else if (tag.m_key == "tracktype") |
| 613 | trackGrade = tag.m_value; |
| 614 | else if (tag.m_key == "highway" && tag.m_value != "ford") |
| 615 | highway = tag.m_value; |
| 616 | else if (tag.m_key == "4wd_only" && (tag.m_value == "yes" || tag.m_value == "recommended")) |
| 617 | return "unpaved_bad"; |
| 618 | |
| 619 | // According to https://wiki.openstreetmap.org/wiki/Key:surface |
| 620 | static base::StringIL pavedSurfaces = { |
| 621 | "asphalt", "cobblestone", "chipseal", "concrete", "grass_paver", "stone", "metal", "paved", |
| 622 | "paving_stones", "sett", "brick", "bricks", "unhewn_cobblestone", "wood"}; |
| 623 | |
| 624 | // All not explicitly listed surface types are considered unpaved good, e.g. "compacted", "fine_gravel". |
| 625 | static base::StringIL badSurfaces = {"cobblestone", |
| 626 | "dirt", |
| 627 | "earth", |
| 628 | "soil", |
| 629 | "grass", |
| 630 | "gravel", |
| 631 | "ground", |
| 632 | "metal", |
| 633 | "mud", |
| 634 | "rock", |
| 635 | "stone", |
| 636 | "unpaved", |
| 637 | "pebblestone", |
| 638 | "sand", |
| 639 | "sett", |
| 640 | "brick", |
| 641 | "bricks", |
| 642 | "snow", |
| 643 | "stepping_stones", |
| 644 | "unhewn_cobblestone", |
| 645 | "grass_paver", |
| 646 | "wood", |
| 647 | "woodchips"}; |
| 648 | |
| 649 | static base::StringIL veryBadSurfaces = {"dirt", "earth", "soil", "grass", "ground", "mud", |
| 650 | "rock", "sand", "snow", "stepping_stones", "woodchips"}; |
| 651 | |
| 652 | // surface=tartan/artificial_turf/clay are not used for highways (but for sport pitches etc). |
| 653 | |
| 654 | static base::StringIL veryBadSmoothness = {"very_bad", "horrible", "very_horrible", "impassable", |
no test coverage detected