From b1d929dcb7d1a1930542e5294aa2475f6e98e525 Mon Sep 17 00:00:00 2001 From: Emma Tysinger Date: Sat, 11 May 2024 18:53:58 -0400 Subject: [PATCH] fix ordering of layers --- src/routes/dashboard/Dashboard.svelte | 58 ++++++++++++++------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/src/routes/dashboard/Dashboard.svelte b/src/routes/dashboard/Dashboard.svelte index f7955db..42095a4 100644 --- a/src/routes/dashboard/Dashboard.svelte +++ b/src/routes/dashboard/Dashboard.svelte @@ -196,6 +196,35 @@ 'layout': {'visibility': 'visible'}, }); + // ADD DASHBOARD LAYER + map.addSource(dashboardSourceId, { + type: 'geojson', + data: 'https://raw.githubusercontent.com/yoakiyama/zoning-dashboard-fp/main/data/Boston_Cambridge_all.geojson', + generateId: false + }); + + dashboardLayerId = 'boston_cambridge_all'; + dashboardLineLayerId = 'boston_cambridge_all_outline'; + map.addLayer({ + 'id': dashboardLayerId, + 'source': dashboardSourceId, + 'type': 'fill', + 'paint': { + 'fill-color': 'hsla(200, 100%, 100%, 0.8)' + }, + 'layout': {'visibility': 'none'}, + }); + map.addLayer({ + 'id': dashboardLineLayerId, + 'source': dashboardSourceId, + 'type': 'line', + 'paint': { + 'line-color': defaultOutlineColor, + 'line-opacity': 0.95 + }, + 'layout': {'visibility': 'none'}, + }); + // ADD COMMUTE LAYER map.addSource("Boston_Cambridge_Commute", { type: 'geojson', @@ -362,34 +391,7 @@ 'layout': {'visibility': 'none'}, }); - // ADD DASHBOARD LAYER - map.addSource(dashboardSourceId, { - type: 'geojson', - data: 'https://raw.githubusercontent.com/yoakiyama/zoning-dashboard-fp/main/data/Boston_Cambridge_all.geojson', - generateId: false - }); - - dashboardLayerId = 'boston_cambridge_all'; - dashboardLineLayerId = 'boston_cambridge_all_outline'; - map.addLayer({ - 'id': dashboardLayerId, - 'source': dashboardSourceId, - 'type': 'fill', - 'paint': { - 'fill-color': 'hsla(200, 100%, 100%, 0.8)' - }, - 'layout': {'visibility': 'none'}, - }); - map.addLayer({ - 'id': dashboardLineLayerId, - 'source': dashboardSourceId, - 'type': 'line', - 'paint': { - 'line-color': defaultOutlineColor, - 'line-opacity': 0.95 - }, - 'layout': {'visibility': 'none'}, - }); +