[coding] Store alt_name and old_name from osm.

This commit is contained in:
tatiana-yan 2020-06-08 16:00:52 +03:00 committed by mpimenov
parent 30831e0a09
commit 34de7ac653
5 changed files with 49 additions and 10 deletions

View file

@ -55,22 +55,22 @@ array<StringUtf8Multilang::Lang, StringUtf8Multilang::kMaxSupportedLanguages> co
{"ro", "Română", ""},
{"sq", "Shqip", ""},
{"am", "አማርኛ", "Amharic-Latin/BGN"},
{"no", "Norsk", ""}, // Was "fy" before December 2018.
{"no", "Norsk", ""}, // Was "fy" before December 2018.
{"cs", "Čeština", ""},
{"id", "Bahasa Indonesia", ""}, // Was "gd" before December 2018.
{"id", "Bahasa Indonesia", ""}, // Was "gd" before December 2018.
{"sk", "Slovenčina", ""},
{"af", "Afrikaans", ""},
{"ja_kana", "日本語(カタカナ)", "Katakana-Latin"},
{StringUtf8Multilang::kReservedLang /* lb */, "", ""},
{"pt", "Português", ""},
{"hr", "Hrvatski", ""},
{"da", "Dansk", ""}, // Was "fur" before December 2018.
{"da", "Dansk", ""}, // Was "fur" before December 2018.
{"vi", "Tiếng Việt", ""},
{"tr", "Türkçe", ""},
{"bg", "Български", "Bulgarian-Latin/BGN"},
{StringUtf8Multilang::kReservedLang /* eo */, "", ""},
{"alt_name", "Alternative name", "Any-Latin"}, // Was "eo" before December 2018.
{"lt", "Lietuvių", ""},
{StringUtf8Multilang::kReservedLang /* la */, "", ""},
{"old_name", "Old/Previous name", "Any-Latin"}, // Was "la" before December 2018.
{"kk", "Қазақ", "Kazakh-Latin/BGN"},
{StringUtf8Multilang::kReservedLang /* gsw */, "", ""},
{"et", "Eesti", ""},

View file

@ -871,6 +871,44 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Hotel)
}
}
UNIT_CLASS_TEST(TestWithClassificator, OsmType_OldName)
{
{
Tags const tags = {
{"highway", "residential"},
{"name", "Улица Веткина"},
{"old_name", "Царская Ветка"}
};
auto const params = GetFeatureBuilderParams(tags);
std::string s;
params.name.GetString(StringUtf8Multilang::kDefaultCode, s);
TEST_EQUAL(s, "Улица Веткина", ());
params.name.GetString(StringUtf8Multilang::GetLangIndex("old_name"), s);
TEST_EQUAL(s, "Царская Ветка", ());
}
}
UNIT_CLASS_TEST(TestWithClassificator, OsmType_AltName)
{
{
Tags const tags = {
{"tourism", "museum"},
{"name", "Московский музей современного искусства"},
{"alt_name", "MMOMA"}
};
auto const params = GetFeatureBuilderParams(tags);
std::string s;
params.name.GetString(StringUtf8Multilang::kDefaultCode, s);
TEST_EQUAL(s, "Московский музей современного искусства", ());
params.name.GetString(StringUtf8Multilang::GetLangIndex("alt_name"), s);
TEST_EQUAL(s, "MMOMA", ());
}
}
UNIT_CLASS_TEST(TestWithClassificator, OsmType_MergeTags)
{
{

View file

@ -46,8 +46,8 @@ public:
if (!token)
return false;
// Is this an international (latin) name.
if (*token == "int_name")
// Is this an international (latin) / old / alternative name.
if (*token == "int_name" || *token == "old_name" || *token == "alt_name")
{
lang = *token;
return m_savedNames.insert(lang).second;

View file

@ -59,8 +59,6 @@ void OsmElement::AddTag(char const * key, char const * value)
SKIP_KEY_BY_PREFIX("whitewater"); // https://wiki.openstreetmap.org/wiki/Whitewater_sports
// In future we can use this tags for improve our search
SKIP_KEY_BY_PREFIX("old_name");
SKIP_KEY_BY_PREFIX("alt_name");
SKIP_KEY_BY_PREFIX("nat_name");
SKIP_KEY_BY_PREFIX("reg_name");
SKIP_KEY_BY_PREFIX("loc_name");

View file

@ -122,8 +122,11 @@ void RelationTagsWay::Process(RelationElement const & e)
Base::AddCustomTag({"addr:street", p.second});
// All "name" tags should be skipped.
if (strings::StartsWith(p.first, "name") || p.first == "int_name")
if (strings::StartsWith(p.first, "name") || p.first == "int_name" || p.first == "old_name" ||
p.first == "alt_name")
{
continue;
}
if (!isBoundary && p.first == "boundary")
continue;