forked from organicmaps/organicmaps
[generator] Process associatedStreet relation
This commit is contained in:
parent
389a5cef87
commit
0d713d9e44
2 changed files with 17 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue