Mining Towns in the Western United States

    0
    58

    []  Active Town mappin semi Near Ghost Town mappin ghost Ghost Town

    ` ; } document.addEventListener(“click”, function (e) { console.log(‘e’, e); if (e.target.id === “loadMinesLayer”) { e.target.innerText = “Loading…” loadMinesLayer(); } if (e.target.id === “filtersSlideOut”) { const d = document.getElementById(‘filterForm’); if(d.classList.contains(“closed”)){ document.getElementById(‘filterForm’).classList.replace(‘closed’,’opened’); }else{ document.getElementById(‘filterForm’).classList.replace(‘opened’,’closed’); } document.getElementById(‘filtersSlideOut’).classList.toggle(‘up’); } if (e.target.classList.contains(“setMinesColor”) ) { const color = e.target.style.backgroundColor; console.log(‘setMinesColor!!!!!!!!’,color); document.getElementById(“minesColor”).style.backgroundImage = “”; document.getElementById(“minesColor”).style.backgroundColor = color; var rgb = color.match(/d+/g).map(Number) goldMines = { …goldMines, getFillColor: rgb,updateTriggers:{ getFillColor: [ rgb ] }} render() } if (e.target.classList.contains(“setMinesColorGOLD”) ) { const color = e.target.style.backgroundColor; document.getElementById(“minesColor”).style.backgroundImage = `linear-gradient(90deg, rgb(255, 215, 0) 50%, black 50%)`; a = [255,215,0] b = [0,0,0] goldMines = { …goldMines, getFillColor: d=>{ const str = d.commodity.toLowerCase() if(str.includes(“gold”)){ return a }else{ return b; } }, updateTriggers:{ getFillColor: [ a, b ] } } render() } if (e.target.classList.contains(“closeLoadingDiv”) ) { document.getElementById(‘loading’).style.display = “none” } }) document.addEventListener(“change”, function (e) { console.log(‘e’, e); const target = e.target; if (target.id === “goldMines”) { goldMines = { …goldMines, visible: target.checked } render() } if (target.id === “miningClaims”) { Gold_Explorer_Placer_Claims_2019 = { …Gold_Explorer_Placer_Claims_2019, visible: target.checked } render() } if (target.id === “miningTowns”) { miningTowns = { …miningTowns, visible: target.checked } render() } if (target.id === “historicData”) { historicData = { …historicData, visible: target.checked } render() } if (target.id === “countyBorders”) { county = { …county, visible: target.checked } render() } }) function MapTypeControl(controlDiv, map) { // Set CSS for the control border. var controlUI = document.createElement(‘div’); controlDiv.appendChild(controlUI); // var mapButton = document.createElement(‘button’); // mapButton.classList.add(‘typesbutton’) // mapButton.innerHTML = ‘Map’ // mapButton.addEventListener(‘click’, function () { // map.setMapTypeId(“roadmap”) // setCurrent(this) // }); // controlUI.appendChild(mapButton); // var terrainStyle = document.createElement(‘button’); // terrainStyle.classList.add(‘typesbutton’) // terrainStyle.classList.add(‘currentStyle’) // terrainStyle.innerHTML = ‘Terrain’ // terrainStyle.addEventListener(‘click’, function () { // map.setMapTypeId(“terrain”) // setCurrent(this) // }); // controlUI.appendChild(terrainStyle); // var satelliteStyle = document.createElement(‘button’); // satelliteStyle.classList.add(‘typesbutton’) // satelliteStyle.innerHTML = ‘Satellite’ // satelliteStyle.addEventListener(‘click’, function () { // map.setMapTypeId(“satellite”) // setCurrent(this) // }); // controlUI.appendChild(satelliteStyle); function setCurrent(e){ console.log(‘e’,e,); document.querySelector(“.typesbutton.currentStyle”).classList.remove(“currentStyle”) e.classList.add(“currentStyle”); } } function LayersTypeControl(controlDiv, map) { // Set CSS for the control border. var controlUI = document.createElement(‘div’); //controlUI.style.border = ‘1px solid red’ controlUI.style.margin = ’10px’ controlDiv.appendChild(controlUI); /* */ /* var Gold_Mines = document.createElement(‘button’); Gold_Mines.classList.add(‘showHide’) Gold_Mines.innerHTML = ‘Gold Mines’ Gold_Mines.addEventListener(‘click’, function (e) { goldMines = { …goldMines, visible: !goldMines.visible } buttonGray(e, goldMines.visible) render() }); controlUI.appendChild(Gold_Mines); var Gold_Explorer_Placer_Claims_2019Button = document.createElement(‘button’); Gold_Explorer_Placer_Claims_2019Button.classList.add(‘showHide’) Gold_Explorer_Placer_Claims_2019Button.innerHTML = ‘Placer Claims’ Gold_Explorer_Placer_Claims_2019Button.addEventListener(‘click’, function (e) { Gold_Explorer_Placer_Claims_2019 = { …Gold_Explorer_Placer_Claims_2019, visible: !Gold_Explorer_Placer_Claims_2019.visible } buttonGray(e, Gold_Explorer_Placer_Claims_2019.visible) render() }); controlUI.appendChild(Gold_Explorer_Placer_Claims_2019Button); var countyButton = document.createElement(‘button’); countyButton.classList.add(‘showHide’) countyButton.innerHTML = ‘County Borders’ countyButton.addEventListener(‘click’, function (e) { console.log(‘county’, county); county = { …county, visible: !county.visible } buttonGray(e, county.visible) render() }); controlUI.appendChild(countyButton); var Mining_TownsButton = document.createElement(‘button’); Mining_TownsButton.classList.add(‘showHide’) Mining_TownsButton.classList.add(‘hidden’) Mining_TownsButton.innerHTML = ‘Mining Towns’ Mining_TownsButton.addEventListener(‘click’, function (e) { miningTowns = { …miningTowns, visible: !miningTowns.visible } buttonGray(e, miningTowns.visible) render() }); controlUI.appendChild(Mining_TownsButton); var Historic_DataButton = document.createElement(‘button’); Historic_DataButton.classList.add(‘showHide’) Historic_DataButton.classList.add(‘hidden’) Historic_DataButton.innerHTML = ‘Gold Districts’ Historic_DataButton.addEventListener(‘click’, function (e) { historicData = { …historicData, visible: !historicData.visible } buttonGray(e, historicData.visible) render() }); controlUI.appendChild(Historic_DataButton); */ } deckOverlay = new deck.GoogleMapsOverlay(); deckOverlay.setMap(map); createInfowindow(deckOverlay) google.maps.event.addListener(map, ‘zoom_changed’, function () { const z = map.getZoom(); // get current zoom level if (z >= 0 && z 7 && z 10) { // zoom level over 10 miningTownsSize = 3 goldMinesSize = 3 historicDataSize = 3 Gold_Explorer_Placer_Claims_2019Size = 3 } console.log(‘z, circleSize’, z, miningTownsSize); miningTowns.radiusMinPixels = miningTownsSize miningTowns.radiusMaxPixels = miningTownsSize goldMines.radiusMinPixels = goldMinesSize goldMines.radiusMaxPixels = goldMinesSize // historicData.radiusMinPixels = historicDataSize // historicData.radiusMaxPixels = historicDataSize // Gold_Explorer_Placer_Claims_2019.radiusMinPixels = Gold_Explorer_Placer_Claims_2019Size // Gold_Explorer_Placer_Claims_2019.radiusMaxPixels = Gold_Explorer_Placer_Claims_2019Size render(); }); function buttonGray(e, v) { if (!v) { e.target.classList.add(“hidden”) } else { e.target.classList.remove(“hidden”) } } function render() { deckOverlay.setProps({ layers: [ new deck.ScatterplotLayer(goldMines), new deck.IconLayer(historicData), new deck.ScatterplotLayer(Gold_Explorer_Placer_Claims_2019), new deck.GeoJsonLayer(county), new deck.IconLayer(miningTowns), ] }); } function consume(reader, size, id, fileSize = 1, prefix) { //fileSize (in bytes) in case the server does not return a ‘Content-Length’ header var total = 0 let data = “”; if (!size || size === null || size === undefined || size === 0) { size = fileSize; } return pump() function pump() { return reader.read().then(({ done, value }) => { if (done) { return data; } total += value.byteLength if(id){ id.innerHTML = prefix + ‘ ‘ + Math.round((total / size) * 100) + ‘%’; } data += new TextDecoder(“utf-8”).decode(value); return pump() }) } } const loading = loadingDone() function loadingDone(layer) { let counter = 0 const…
    Source