Skip to content

Commit 122c163

Browse files
authored
Fix roundabouts (#708)
1 parent 2b68d2c commit 122c163

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

resources/process-openmaptiles.lua

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ z11RoadValues = Set { "tertiary", "tertiary_link", "busway", "bus_guideway" }
225225
z12MinorRoadValues = Set { "unclassified", "residential", "road", "living_street" }
226226
z12OtherRoadValues = Set { "raceway" }
227227
z13RoadValues = Set { "track", "service" }
228-
manMadRoadValues = Set { "pier", "bridge" }
228+
manMadeRoadValues = Set { "pier", "bridge" }
229229
pathValues = Set { "footway", "cycleway", "bridleway", "path", "steps", "pedestrian", "platform" }
230230
linkValues = Set { "motorway_link", "trunk_link", "primary_link", "secondary_link", "tertiary_link" }
231231
pavedValues = Set { "paved", "asphalt", "cobblestone", "concrete", "concrete:lanes", "concrete:plates", "metal", "paving_stones", "sett", "unhewn_cobblestone", "wood" }
@@ -307,8 +307,8 @@ function relation_scan_function()
307307
end
308308
end
309309

310-
function write_to_transportation_layer(minzoom, highway_class, subclass, ramp, service, is_rail, is_road)
311-
Layer("transportation", IsClosed())
310+
function write_to_transportation_layer(minzoom, highway_class, subclass, ramp, service, is_rail, is_road, is_area)
311+
Layer("transportation", is_area)
312312
SetZOrder()
313313
Attribute("class", highway_class)
314314
if subclass and subclass ~= "" then
@@ -317,7 +317,7 @@ function write_to_transportation_layer(minzoom, highway_class, subclass, ramp, s
317317
AttributeNumeric("layer", tonumber(Find("layer")) or 0, accessMinzoom)
318318
SetBrunnelAttributes()
319319
-- We do not write any other attributes for areas.
320-
if IsClosed() then
320+
if is_area then
321321
SetMinZoomByAreaWithLimit(minzoom)
322322
return
323323
end
@@ -377,10 +377,11 @@ function way_function()
377377
local aerialway = Find("aerialway")
378378
local public_transport = Find("public_transport")
379379
local place = Find("place")
380-
local isClosed = IsClosed()
380+
local is_closed = IsClosed()
381381
local housenumber = Find("addr:housenumber")
382382
local write_name = false
383383
local construction = Find("construction")
384+
local is_highway_area = highway~="" and Find("area")=="yes" and is_closed
384385

385386
-- Miscellaneous preprocessing
386387
if Find("disused") == "yes" then return end
@@ -443,7 +444,7 @@ function way_function()
443444

444445
-- Aerialways ('transportation' and 'transportation_name')
445446
if aerialway ~= "" then
446-
write_to_transportation_layer(12, "aerialway", aerialway, false, nil, false, false)
447+
write_to_transportation_layer(12, "aerialway", aerialway, false, nil, false, false, is_closed)
447448
if HasNames() then
448449
Layer("transportation_name", false)
449450
MinZoom(12)
@@ -475,6 +476,7 @@ function way_function()
475476
elseif h == "trunk" then minzoom = 5
476477
elseif highway == "primary" then minzoom = 7
477478
elseif z9RoadValues[h] then minzoom = 9
479+
elseif z10RoadValues[h] then minzoom = 10
478480
elseif z11RoadValues[h] then minzoom = 11
479481
elseif z12MinorRoadValues[h] then
480482
minzoom = 12
@@ -509,16 +511,16 @@ function way_function()
509511
end
510512

511513
-- Drop all areas except infrastructure for pedestrians handled above
512-
if isClosed and h ~= "path" then
514+
if is_highway_area and h ~= "path" then
513515
minzoom = INVALID_ZOOM
514516
end
515517

516518
-- Write to layer
517519
if minzoom <= 14 then
518-
write_to_transportation_layer(minzoom, h, subclass, ramp, service, false, is_road)
520+
write_to_transportation_layer(minzoom, h, subclass, ramp, service, false, is_road, is_highway_area)
519521

520522
-- Write names
521-
if not isClosed and (HasNames() or Holds("ref")) then
523+
if not is_closed and (HasNames() or Holds("ref")) then
522524
if h == "motorway" then
523525
minzoom = 7
524526
elseif h == "trunk" then
@@ -565,7 +567,7 @@ function way_function()
565567
elseif railway == "light_rail" and service == "" then
566568
minzoom = 11
567569
end
568-
write_to_transportation_layer(minzoom, class, railway, false, service, true, false)
570+
write_to_transportation_layer(minzoom, class, railway, false, service, true, false, is_closed)
569571

570572
if HasNames() then
571573
Layer("transportation_name", false)
@@ -577,13 +579,13 @@ function way_function()
577579
end
578580

579581
-- Pier
580-
if manMadRoadValues[man_made] then
581-
write_to_transportation_layer(13, man_made, nil, false, nil, false, false)
582+
if manMadeRoadValues[man_made] then
583+
write_to_transportation_layer(13, man_made, nil, false, nil, false, false, is_closed)
582584
end
583585

584586
-- 'Ferry'
585587
if route=="ferry" then
586-
write_to_transportation_layer(9, "ferry", nil, false, nil, false, false)
588+
write_to_transportation_layer(9, "ferry", nil, false, nil, false, false, is_closed)
587589

588590
if HasNames() then
589591
Layer("transportation_name", false)
@@ -595,7 +597,7 @@ function way_function()
595597

596598
-- 'Aeroway'
597599
if aeroway~="" then
598-
Layer("aeroway", isClosed)
600+
Layer("aeroway", is_closed)
599601
Attribute("class",aeroway)
600602
Attribute("ref",Find("ref"))
601603
write_name = true
@@ -616,7 +618,7 @@ function way_function()
616618
end
617619

618620
-- Set 'waterway' and associated
619-
if waterwayClasses[waterway] and not isClosed then
621+
if waterwayClasses[waterway] and not is_closed then
620622
if waterway == "river" and Holds("name") then
621623
Layer("waterway", false)
622624
else
@@ -626,12 +628,12 @@ function way_function()
626628
Attribute("class", waterway)
627629
SetNameAttributes()
628630
SetBrunnelAttributes()
629-
elseif waterway == "boatyard" then Layer("landuse", isClosed); Attribute("class", "industrial"); MinZoom(12)
630-
elseif waterway == "dam" then Layer("building",isClosed)
631-
elseif waterway == "fuel" then Layer("landuse", isClosed); Attribute("class", "industrial"); MinZoom(14)
631+
elseif waterway == "boatyard" then Layer("landuse", is_closed); Attribute("class", "industrial"); MinZoom(12)
632+
elseif waterway == "dam" then Layer("building",is_closed)
633+
elseif waterway == "fuel" then Layer("landuse", is_closed); Attribute("class", "industrial"); MinZoom(14)
632634
end
633635
-- Set names on rivers
634-
if waterwayClasses[waterway] and not isClosed then
636+
if waterwayClasses[waterway] and not is_closed then
635637
if waterway == "river" and Holds("name") then
636638
Layer("water_name", false)
637639
else
@@ -657,7 +659,7 @@ function way_function()
657659

658660
-- Set 'water'
659661
if natural=="water" or leisure=="swimming_pool" or landuse=="reservoir" or landuse=="basin" or waterClasses[waterway] then
660-
if Find("covered")=="yes" or not isClosed then return end
662+
if Find("covered")=="yes" or not is_closed then return end
661663
local class="lake"; if waterway~="" then class="river" end
662664
if class=="lake" and Find("wikidata")=="Q192770" then return end
663665
Layer("water",true)

0 commit comments

Comments
 (0)