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;