diff --git a/resources/process-openmaptiles.lua b/resources/process-openmaptiles.lua index 2b1c6bd3..a83676ff 100644 --- a/resources/process-openmaptiles.lua +++ b/resources/process-openmaptiles.lua @@ -382,6 +382,7 @@ function way_function() local write_name = false local construction = Find("construction") local is_highway_area = highway~="" and Find("area")=="yes" and is_closed + local building_part = Find("building:part") -- Miscellaneous preprocessing if Find("disused") == "yes" then return end @@ -644,7 +645,7 @@ function way_function() end -- Set 'building' and associated - if building~="" then + if building~="" or building_part~="" then Layer("building", true) SetBuildingHeightAttributes() SetMinZoomByArea() @@ -867,17 +868,28 @@ end function SetBuildingHeightAttributes() local height = tonumber(Find("height"), 10) + local buildingHeight = tonumber(Find("building:height"), 10) + local finalHeight = height or buildingHeight + local minHeight = tonumber(Find("min_height"), 10) - local levels = tonumber(Find("building:levels"), 10) - local minLevel = tonumber(Find("building:min_level"), 10) + local buildingMinHeight = tonumber(Find("building:min_height"), 10) + local finalMinHeight = minHeight or buildingMinHeight + + local levels = tonumber(Find("levels"), 10) + local buildingLevels = tonumber(Find("building:levels"), 10) + local finalLevels = levels or buildingLevels + + local minLevel = tonumber(Find("min_level"), 10) + local buildingMinLevel = tonumber(Find("building:min_level"), 10) + local finalMinLevel = minLevel or buildingMinLevel local renderHeight = BUILDING_FLOOR_HEIGHT - if height or levels then - renderHeight = height or (levels * BUILDING_FLOOR_HEIGHT) + if finalHeight or finalLevels then + renderHeight = finalHeight or (finalLevels * BUILDING_FLOOR_HEIGHT) end local renderMinHeight = 0 - if minHeight or minLevel then - renderMinHeight = minHeight or (minLevel * BUILDING_FLOOR_HEIGHT) + if finalMinHeight or finalMinLevel then + renderMinHeight = finalMinHeight or (finalMinLevel * BUILDING_FLOOR_HEIGHT) end -- Fix upside-down buildings diff --git a/server/static/index.html b/server/static/index.html index efadb79e..f167e6b1 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -32,7 +32,8 @@ style: styleURL, // stylesheet location center: [(Number(bounds[0])+Number(bounds[2]))/2, (Number(bounds[1])+Number(bounds[3]))/2], // starting position [lng, lat] - zoom: 13 // starting zoom + zoom: 13, // starting zoom + pitch: 60 // pitch in degrees }); map.addControl(new mapboxgl.NavigationControl()); map.addControl(new mapboxgl.AttributionControl({ compact: false, customAttribution: diff --git a/server/static/style.json b/server/static/style.json index af6fc607..ca3fdb98 100644 --- a/server/static/style.json +++ b/server/static/style.json @@ -360,31 +360,6 @@ "layout": {"visibility": "visible"}, "paint": {"fill-color": "rgba(245, 238, 188, 1)", "fill-opacity": 1} }, - { - "id": "building", - "type": "fill", - "metadata": {"mapbox:group": "1444849364238.8171"}, - "source": "openmaptiles", - "source-layer": "building", - "paint": { - "fill-antialias": true, - "fill-color": {"base": 1, "stops": [[15.5, "#f2eae2"], [16, "#dfdbd7"]]} - } - }, - { - "id": "building-top", - "type": "fill", - "metadata": {"mapbox:group": "1444849364238.8171"}, - "source": "openmaptiles", - "source-layer": "building", - "layout": {"visibility": "visible"}, - "paint": { - "fill-color": "#f2eae2", - "fill-opacity": {"base": 1, "stops": [[13, 0], [16, 1]]}, - "fill-outline-color": "#dfdbd7", - "fill-translate": {"base": 1, "stops": [[14, [0, 0]], [16, [-2, -2]]]} - } - }, { "id": "tunnel-service-track-casing", "type": "line", @@ -2444,6 +2419,38 @@ "text-halo-color": "rgba(255,255,255,0.8)", "text-halo-width": 2 } + }, + + { + "id": "building", + "type": "fill", + "metadata": {"mapbox:group": "1444849364238.8171"}, + "source": "openmaptiles", + "source-layer": "building", + "minzoom": 13, + "maxzoom": 21, + "layout": { + "visibility": "visible" + }, + "paint": { + "fill-color": "rgba(203, 198, 198, 1)", + "fill-outline-color": {"base": 1, "stops": [[13,"rgba(131, 123, 123, 0.32)"], [14,"rgba(157, 3, 5, 1)"]]} + } + }, + { + "id": "building-3d", + "type": "fill-extrusion", + "metadata": {"mapbox:group": "1444849364238.8171"}, + "source": "openmaptiles", + "source-layer": "building", + "minzoom": 14, + "layout": {"visibility": "visible"}, + "paint": { + "fill-extrusion-color": "rgba(203, 198, 198, 1)", + "fill-extrusion-height": {"property": "render_height","type": "identity"}, + "fill-extrusion-base": {"property": "render_min_height","type": "identity"}, + "fill-extrusion-opacity": 0.95 + } } ], "id": "bright"