diff --git a/src/layerData.json b/src/layerData.json index eb7e6dfb5..4e4afd40f 100644 --- a/src/layerData.json +++ b/src/layerData.json @@ -7,15 +7,7 @@ }, "description": "The World Air Quality Index project provides transparent and world-wide air quality information for more than 100 countries, covering more than 12,000 stations in 1000 major cities.", "layer_desc": "World-wide air quality information", - "icon": "#096", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#096" }, "eonetFires": { "url": "https://eonet.sci.gsfc.nasa.gov/", @@ -25,15 +17,7 @@ }, "description": "EONET provides a curated source of continuously updated natural event metadata. EONET Events: Wildfires: Wildfires includes all nature of fire, including forest and plains fires, as well as urban and industrial fire events. Fires may be naturally caused or manmade.", "layer_desc": "All nature of fire events.", - "icon": "#ff421d", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#ff421d" }, "fractracker": { "url": "https://www.fractracker.org/", @@ -45,10 +29,6 @@ "layer_desc": "Oil and gas development", "icon": "#e8e800", "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], "minZoom": 5, "maxZoom": 15 } @@ -81,10 +61,6 @@ "layer_desc": "Indigenous nations - Territories, Languages, Treaties", "icon": "#532200", "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], "minZoom": 6, "maxZoom": 15 } @@ -115,15 +91,7 @@ }, "description": "building particulate matter sensors and visualizing the data in an overall picture.", "layer_desc": "Fine dust measurement", - "icon": "#4edd51", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#4edd51" }, "mapknitter": { "url": "https://mapknitter.org/", @@ -135,10 +103,6 @@ "layer_desc": "Map data from aerial photos from balloons and kites", "icon": "#ca283b", "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], "minZoom": 10, "maxZoom": 15 } @@ -154,10 +118,6 @@ "layer_desc": "Bad odor events", "icon": "#ff00ff", "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], "minZoom": 8, "maxZoom": 15 } @@ -170,15 +130,7 @@ }, "description": "OpenAQ is a non-profit organization empowering communities around the globe to clean their air by harmonizing, sharing, and using open air quality data.", "layer_desc": "Air quality data", - "icon": "#912d25", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#912d25" }, "openInfraMap": { "url": "https://openinframap.org/about.html", @@ -188,15 +140,7 @@ }, "description": "Open Infrastructure Map is a view of the world's hidden infrastructure mapped in the OpenStreetMap database.", "layer_desc": "World's hidden infrastructure", - "icon": "#b59f10", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#b59f10" }, "opensense": { "url": "https://opensensemap.org/", @@ -207,15 +151,7 @@ }, "description": "openSenseMap is a platform for open sensor data at which everyone can participate in.", "layer_desc": "Sensor data from senseboxes", - "icon": "", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "" }, "openWeatherMap": { "url": "https://openweathermap.org/guide", @@ -225,15 +161,7 @@ }, "description": "OpenWeatherMap provides many kinds of weather maps including Precipitation, Clouds, Pressure, Temperature, Wind.", "layer_desc": "Weather information", - "icon": "#00a3fe", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#00a3fe" }, "osmlandfills,quarries": { "url": "https://www.openstreetmap.org/about", @@ -245,10 +173,6 @@ "layer_desc": "Land used for landfill and mine quarry", "icon": "#008000", "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], "minZoom": 11, "maxZoom": 15 } @@ -281,15 +205,7 @@ }, "description": "An air quality monitoring network built on a new generation of \"Internet of Things\" sensors", "layer_desc": "Air quality data from PurpleAir sensors", - "icon": "#7c22b5", - "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], - "minZoom": 3, - "maxZoom": 15 - } + "icon": "#7c22b5" }, "skytruth": { "url": "https://alerts.skytruth.org/", @@ -301,10 +217,6 @@ "layer_desc": "Environmentally significant incidents", "icon": "#f00", "extents": { - "bounds": [ - [-44.087585028245165, -148.88671875000003], - [76.63922560965888, 140.62500000000003] - ], "minZoom": 10, "maxZoom": 15 } diff --git a/src/util/layersBrowser.js b/src/util/layersBrowser.js index 87db7e929..5af2422f4 100644 --- a/src/util/layersBrowser.js +++ b/src/util/layersBrowser.js @@ -439,15 +439,17 @@ L.Control.LayersBrowser = L.Control.Layers.extend({ var currentBounds = map.getBounds(); var currentZoom = map.getZoom(); var bounds; + var zoom; if(data) { - bounds = L.latLngBounds(data.extents.bounds); + bounds = data.extents && data.extents.bounds && L.latLngBounds(data.extents.bounds); + zoom = data.extents && data.extents.minZoom && data.extents.minZoom; for(var i in elements) { - if((!bounds.intersects(currentBounds) && map.hasLayer(layerName) && removeFrmMap) || - (currentZoom < data.extents.minZoom && map.hasLayer(layerName) && removeFrmMap)) { + if((bounds && !bounds.intersects(currentBounds) && map.hasLayer(layerName) && removeFrmMap) || + ( zoom && (currentZoom < zoom) && map.hasLayer(layerName) && removeFrmMap)) { elements[i].style.display = 'none'; // Remove layer from map if active map.removeLayer(layerName); - } else if(!bounds.intersects(currentBounds) || currentZoom < data.extents.minZoom) { + } else if((bounds && !bounds.intersects(currentBounds)) || (zoom && (currentZoom < zoom))) { elements[i].style.display = 'none'; } else { elements[i].style.display = 'block';