corpDeckGL = {
const accessMapLayer = new deck.GeoJsonLayer({
data: filteredAreas,
pickable: true,
getFillColor: function(dataRow) {
switch(dataRow.properties.plant_access){
case 1:
return colorPalette["One Plant"]
case 2:
return colorPalette["Two Plants"]
case 3:
return colorPalette["Three Plants"]
case 4:
return colorPalette["4+ Plants"]
}
}
})
const corpMapLayer = new deck.GeoJsonLayer({
data: stateCorpMonopsony,
pickable: true,
getFillColor: function(dataRow) {
return colorPalette[dataRow.properties.parent_corporation]
}
})
const plantLayer = new deck.IconLayer({
id: 'icon-layer',
data: poultryPlants,
iconAtlas: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.png',
iconMapping: {
marker: {x: 0, y: 0, width: 128, height: 128, mask: true}
},
getIcon: d => 'marker',
getPosition: d => d.geometry.coordinates,
getSize: d => 35,
getColor: d => colorPalette.plant,
pickable: true,
onHover: onHoverPlant
})
const farmLayer = new deck.IconLayer({
id: 'icon-layer',
data: filteredFarms,
pickable: true,
iconAtlas: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.png',
iconMapping: {
marker: {x: 0, y: 0, width: 128, height: 128, mask: true}
},
getIcon: d => 'marker',
getPosition: d => d.geometry.coordinates,
getSize: d => 10,
getColor: d => colorPalette.farm
})
return new deck.DeckGL({
container: container,
map: mapboxgl,
mapboxApiAccessToken: 'pk.eyJ1IjoidWJlcmRhdGEiLCJhIjoiY2pudzRtaWloMDAzcTN2bzN1aXdxZHB5bSJ9.2bkj3IiRC8wj3jLThvDGdA',
mapStyle: 'mapbox://styles/mapbox/dark-v9',
longitude: currentLatLonZoom.longitude,
latitude: currentLatLonZoom.latitude,
zoom: currentLatLonZoom.zoom,
pitch: 0,
bearing: -0,
pickingRadius: 200,
layers: [
accessMapLayer,
plantLayer,
farmLayer
],
})
}