I am building an interactive mapping solution for my employer and have run into a bit of a hangup. I am working with bootstrap for the first time and cannot figure out how to link the dropdown list option to the function that toggles the layers. I have gotten it to work with a button/checkbox(
ROADMAP ), however, I would like to be able to do a multi-select of the dropdown list items to add to the map.
Any help would be greatly appreciated.
HTML:
Test
JS:
L.mapbox.accessToken = 'token here'; var map = L.mapbox.map('map', '', {zoomControl: false}) .setView([34.962497232449145, -92.9168701171875], 14); var roadmap = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); var satellite = L.tileLayer('http://{s}.tiles.mapbox.com/v3/moklick.lh736gg3/{z}/{x}/{y}.png'); var CartoDB_DarkMatter = L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png'); $( ".mapLabel" ).click(function( event ) { console.log("Click"); layerClicked = window[event.target.value]; if (map.hasLayer(layerClicked)) { map.removeLayer(layerClicked); } else{ map.addLayer(layerClicked); } ; });
أكثر...
ROADMAP ), however, I would like to be able to do a multi-select of the dropdown list items to add to the map.
Any help would be greatly appreciated.
HTML:
Test
JS:
L.mapbox.accessToken = 'token here'; var map = L.mapbox.map('map', '', {zoomControl: false}) .setView([34.962497232449145, -92.9168701171875], 14); var roadmap = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); var satellite = L.tileLayer('http://{s}.tiles.mapbox.com/v3/moklick.lh736gg3/{z}/{x}/{y}.png'); var CartoDB_DarkMatter = L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png'); $( ".mapLabel" ).click(function( event ) { console.log("Click"); layerClicked = window[event.target.value]; if (map.hasLayer(layerClicked)) { map.removeLayer(layerClicked); } else{ map.addLayer(layerClicked); } ; });
أكثر...