only use OSM tags for complex types

Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per
2025-12-11 18:09:59 +01:00
parent 4095531f37
commit ad36b5c27d

View File

@@ -53,12 +53,13 @@ void TypeToOSMTranslator::LoadFromStream(std::istream & s)
//LOG(LINFO, ("type: ", tokens[0]));
uint32_t type = classif().GetTypeByPathSafe(strings::Tokenize(tokens[0], "|"));
// Get internal feature type
std::vector<std::string_view> typeTokens = strings::Tokenize(tokens[0], "|");
uint32_t type = classif().GetTypeByPathSafe(typeTokens);
if (tokens.size() == 2)
if (typeTokens.size() <= 2)
{
// OSM tags can be derived from type name
std::vector<std::string_view> typeTokens = strings::Tokenize(tokens[0], "|");
// simple feature type: OSM tags can be derived from type name
ASSERT(typeTokens.size() <= 2, ("OSM tags can not be derived from 3-arity/complex types"));
ASSERT(!typeTokens.empty(), ("No type name found"));
@@ -79,13 +80,14 @@ void TypeToOSMTranslator::LoadFromStream(std::istream & s)
LOG(LINFO, ("Simple type: Added type ", type, ":", osmTag.key, "=", osmTag.value));
}
else if (tokens.size() > 2)
else
{
// OSM tags are listed in the entry
LOG(LINFO, ("Complex type: token size:", tokens.size(), " | osmTags: ", tokens[1]));
std::vector<std::string_view> osmTagTokens = strings::Tokenize(tokens[1], ",");
// complex feature type: OSM tags are listed in the entry
ASSERT(tokens.size() > 2, ("OSM tags not listed for complex feature type: ", line));
std::vector<std::string_view> osmTagTokens = strings::Tokenize(tokens[1], ",");
ASSERT(!osmTagTokens.empty(), ("No OSM tag tokens found"));
// First entry is the best practice way to tag a feature
@@ -118,6 +120,8 @@ void TypeToOSMTranslator::LoadFromStream(std::istream & s)
pos = end + 1;
}
m_storage.insert({type, osmTags});
}
if (lineNumber > 80)