Allow more than one number for level

Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per 2025-01-03 20:38:35 +01:00 committed by Konstantin Pastbin
parent 199094a466
commit e2f5005ce8

View file

@ -28,7 +28,6 @@ constexpr char const * kOSMMultivalueDelimiter = ";";
// https://en.wikipedia.org/wiki/List_of_tallest_buildings_in_the_world
auto constexpr kMaxBuildingLevelsInTheWorld = 167;
auto constexpr kMinBuildingLevel = -6;
template <class T>
void RemoveDuplicatesAndKeepOrder(std::vector<T> & vec)
@ -229,6 +228,7 @@ std::string MetadataTagProcessorImpl::ValidateAndFormat_building_levels(std::str
{
// Some mappers use full width unicode digits. We can handle that.
strings::NormalizeDigits(v);
// value of building_levels is only one number
double levels;
if (Prefix2Double(v, levels) && levels >= 0 && levels <= kMaxBuildingLevelsInTheWorld)
return strings::to_string_dac(levels, 1);
@ -240,11 +240,8 @@ std::string MetadataTagProcessorImpl::ValidateAndFormat_level(std::string v)
{
// Some mappers use full width unicode digits. We can handle that.
strings::NormalizeDigits(v);
double levels;
if (Prefix2Double(v, levels) && levels >= kMinBuildingLevel && levels <= kMaxBuildingLevelsInTheWorld)
return strings::to_string(levels);
return {};
// value of level can be more than one number, so e.g. "1;2" or "3-5"
return v;
}
std::string MetadataTagProcessorImpl::ValidateAndFormat_denomination(std::string const & v)