diff options
author | mgsergio <mgsergio@yandex.ru> | 2016-07-08 14:59:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-08 14:59:32 +0300 |
commit | aef5903ca959a9175c52e35c7746655319bebcba (patch) | |
tree | 0ca49eba32c38df70ef093f9807a0bbdebc157a4 /generator | |
parent | 1d667777aca1d5791a8cd69305d863dc712b71ff (diff) | |
parent | b6626f44a3af6b65569c5ff38d943d777b2c1cbe (diff) |
Merge pull request #3710 from Zverik/public_transport_tags
[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 4e1c14d12c..1fdcd45093 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -409,7 +409,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; @@ -473,6 +473,8 @@ namespace ftype char const * layer = nullptr; bool isSubway = false; + bool isBus = false; + bool isTram = false; TagProcessor(p).ApplyRules ({ @@ -481,6 +483,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. @@ -499,6 +504,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) |