Skip to content

Commit 9ae6a27

Browse files
authored
handle numeric values of layer and level tags with math.floor (#859)
1 parent ea8d215 commit 9ae6a27

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

resources/process-openmaptiles.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ function write_to_transportation_layer(minzoom, highway_class, subclass, ramp, s
314314
if subclass and subclass ~= "" then
315315
Attribute("subclass", subclass)
316316
end
317-
AttributeInteger("layer", tonumber(Find("layer")) or 0, accessMinzoom)
317+
local layer = tonumber(Find("layer")) or 0
318+
AttributeInteger("layer", math.floor(layer), accessMinzoom)
318319
SetBrunnelAttributes()
319320
-- We do not write any other attributes for areas.
320321
if is_area then
@@ -755,13 +756,14 @@ function WritePOI(class,subclass,rank)
755756
Attribute("class", class)
756757
Attribute("subclass", subclass)
757758
-- layer defaults to 0
758-
AttributeInteger("layer", tonumber(Find("layer")) or 0)
759+
local layer = tonumber(Find("layer")) or 0
760+
AttributeInteger("layer", math.floor(layer))
759761
-- indoor defaults to false
760762
AttributeBoolean("indoor", (Find("indoor") == "yes"))
761763
-- level has no default
762764
local level = tonumber(Find("level"))
763765
if level then
764-
AttributeInteger("level", level)
766+
AttributeInteger("level", math.floor(level))
765767
end
766768
end
767769

0 commit comments

Comments
 (0)