diff options
author | Ilya Zverev <zverik@textual.ru> | 2016-06-09 16:24:38 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-06-23 19:23:38 +0300 |
commit | 0d713d9e442f8ef866942798abc277991c70cf13 (patch) | |
tree | a184de9fc4cddb5250a7547355115fcbd8c4c5d1 /generator | |
parent | 389a5cef873b809b72e93b0216c91ec0d4fddcf3 (diff) |
[generator] Process associatedStreet relation
Diffstat (limited to 'generator')
-rw-r--r-- | generator/osm_source.cpp | 3 | ||||
-rw-r--r-- | generator/osm_translator.hpp | 17 |
2 files changed, 17 insertions, 3 deletions
diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp index 65937d335f..3992b9016f 100644 --- a/generator/osm_source.cpp +++ b/generator/osm_source.cpp @@ -133,7 +133,8 @@ public: void AddRelation(TKey id, RelationElement const & e) { string const & relationType = e.GetType(); - if (!(relationType == "multipolygon" || relationType == "route" || relationType == "boundary")) + if (!(relationType == "multipolygon" || relationType == "route" || + relationType == "boundary" || relationType == "associatedStreet")) return; m_relations.Write(id, e); diff --git a/generator/osm_translator.hpp b/generator/osm_translator.hpp index 24cf203362..bf5595c426 100644 --- a/generator/osm_translator.hpp +++ b/generator/osm_translator.hpp @@ -157,9 +157,13 @@ class RelationTagsNode : public RelationTagsBase protected: void Process(RelationElement const & e) override { - if (TBase::IsSkipRelation(e.GetType())) + string const & type = e.GetType(); + if (TBase::IsSkipRelation(type)) return; + bool const processAssociatedStreet = type == "associatedStreet" && + TBase::IsKeyTagExists("addr:housenumber") && !TBase::IsKeyTagExists("addr:street"); + for (auto const & p : e.tags) { // - used in railway station processing @@ -172,6 +176,9 @@ protected: if (!TBase::IsKeyTagExists(p.first)) TBase::AddCustomTag(p); } + // Convert associatedStreet relation name to addr:street tag if we don't have one. + else if (p.first == "name" && processAssociatedStreet) + TBase::AddCustomTag({"addr:street", p.second}); } } }; @@ -196,11 +203,13 @@ protected: { /// @todo Review route relations in future. /// Actually, now they give a lot of dummy tags. - string const type = e.GetType(); + string const & type = e.GetType(); if (TBase::IsSkipRelation(type) || type == "route") return; bool const isBoundary = (type == "boundary") && IsAcceptBoundary(e); + bool const processAssociatedStreet = type == "associatedStreet" && + TBase::IsKeyTagExists("addr:housenumber") && !TBase::IsKeyTagExists("addr:street"); for (auto const & p : e.tags) { @@ -208,6 +217,10 @@ protected: if (p.first == "type" || p.first == "route" || p.first == "area") continue; + // Convert associatedStreet relation name to addr:street tag if we don't have one. + if (p.first == "name" && processAssociatedStreet) + TBase::AddCustomTag({"addr:street", p.second}); + // Important! Skip all "name" tags. if (strings::StartsWith(p.first, "name")) continue; |