diff options
author | Ilya Zverev <zverik@textual.ru> | 2016-07-01 19:28:29 +0300 |
---|---|---|
committer | Ilya Zverev <zverik@textual.ru> | 2016-07-07 11:44:57 +0300 |
commit | b6626f44a3af6b65569c5ff38d943d777b2c1cbe (patch) | |
tree | 050195888c028cbe364548c43c0f1b23add11eb4 /generator | |
parent | 66eff8335d24ce6099fd1a2770900b354c119b8c (diff) |
[generator] Process public_transport tags
Diffstat (limited to 'generator')
-rw-r--r-- | generator/osm2type.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index 69adbb490e..13d277e2d0 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -393,7 +393,7 @@ namespace ftype string surface_grade; bool isHighway = false; - for (auto & tag : p->m_tags) + for (auto const & tag : p->m_tags) { if (tag.key == "surface") surface = tag.value; @@ -457,6 +457,8 @@ namespace ftype char const * layer = nullptr; bool isSubway = false; + bool isBus = false; + bool isTram = false; TagProcessor(p).ApplyRules ({ @@ -465,6 +467,9 @@ namespace ftype { "layer", "*", [&hasLayer] { hasLayer = true; }}, { "railway", "subway_entrance", [&isSubway] { isSubway = true; }}, + { "bus", "yes", [&isBus] { isBus = true; }}, + { "trolleybus", "yes", [&isBus] { isBus = true; }}, + { "tram", "yes", [&isTram] { isTram = true; }}, /// @todo Unfortunatelly, it's not working in many cases (route=subway, transport=subway). /// Actually, it's better to process subways after feature types assignment. @@ -483,6 +488,24 @@ namespace ftype } p->AddTag("psurface", DetermineSurface(p)); + + // Convert public_transport tags to the older schema. + for (auto const & tag : p->m_tags) + { + if (tag.key == "public_transport") + { + if (tag.value == "platform" && isBus) + { + if (p->type == OsmElement::EntityType::Node) + p->AddTag("highway", "bus_stop"); + else + p->AddTag("highway", "platform"); + } + else if (tag.value == "stop_position" && isTram && p->type == OsmElement::EntityType::Node) + p->AddTag("railway", "tram_stop"); + break; + } + } } void PostprocessElement(OsmElement * p, FeatureParams & params) |