Skip to content

Commit

Permalink
Treat objects with both a polygon-key and a linestring-key+value as p…
Browse files Browse the repository at this point in the history
…olygon
  • Loading branch information
matthijsmelissen committed Feb 23, 2016
1 parent df7794d commit d169854
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions style.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,17 @@ function filter_tags_way (keyvalues, numberofkeys)
-- Treat objects with a key in polygon_keys as polygon
for i,k in ipairs(polygon_keys) do
if keyvalues[k] then
polygon=1
break
polygontag = 1
-- However, if the key/value combination occurs in linestring_values, do not treat the object as polygon
for index,tag in pairs(linestring_values) do
if k == tag[1] and keyvalues[k] == tag[2] then
polygontag = 0
break
end
end
if polygontag == 1 then
polygon = 1
end
end
end

Expand All @@ -158,14 +167,6 @@ function filter_tags_way (keyvalues, numberofkeys)
break
end
end

-- Treat objects with a key/value combination in linestring_values not as polygon
for index,tag in pairs(linestring_values) do
if keyvalues[tag[1]] == tag[2] then
polygon=0
break
end
end

-- Treat objects tagged as area=yes, area=1, or area=true as polygon,
-- and treat objects tagged as area=no, area=0, or area=false not as polygon
Expand Down Expand Up @@ -212,19 +213,25 @@ function filter_tags_relation_member (keyvalues, keyvaluemembers, roles, memberc
-- First count keys in polygon_keys
for i,k in ipairs(polygon_keys) do
if keyvalues[k] then
polytagcount = polytagcount + 1
polygontag = 1
-- However, if the key/value combination occurs in linestring_values, do not count the object as polygon
for index,tag in pairs(linestring_values) do
if k == tag[1] and keyvalues[k] == tag[2] then
polygontag = 0
break
end
end
if polygontag == 1 then
polytagcount = polytagcount + 1
end
end
end
-- Then add key/value combinations in polygon_values

-- Treat objects with a key/value combination in polygon_values as polygon
for index,tag in pairs(polygon_values) do
if keyvalues[tag[1]] == tag[2] then
polytagcount = polytagcount + 1
end
end
-- Then substract key/value combinations in linestring_values
for index,tag in pairs(linestring_values) do
if keyvalues[tag[1]] == tag[2] then
polytagcount = polytagcount - 1
break
end
end

Expand Down

0 comments on commit d169854

Please sign in to comment.