Commit 9bd35625 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Update mapbox map getter

parent 50a9afdb
...@@ -412,14 +412,14 @@ const populateMap = async (mapData) => { ...@@ -412,14 +412,14 @@ const populateMap = async (mapData) => {
}).addTo(map); }).addTo(map);
// after mapboxGL map is ready with styles do this: // after mapboxGL map is ready with styles do this:
glmap._glMap.on("style.load", () => { glmap.getMapboxMap().on("style.load", () => {
userFiles.forEach(monthYear => { userFiles.forEach(monthYear => {
glmap._glMap.addLayer(currentTiles[monthYear]); glmap.getMapboxMap().addLayer(currentTiles[monthYear]);
}); });
Object.keys(allTiles).forEach(layer => { Object.keys(allTiles).forEach(layer => {
if (layer == userFiles[0]) { if (layer == userFiles[0]) {
glmap._glMap.setPaintProperty(layer, "fill-opacity", 0.7) glmap.getMapboxMap().setPaintProperty(layer, "fill-opacity", 0.7)
} }
}); });
...@@ -465,9 +465,9 @@ const updateMap = (mapData) => { ...@@ -465,9 +465,9 @@ const updateMap = (mapData) => {
return; // if file has already been processed, exit return; // if file has already been processed, exit
} else { // if file cannot be found in allTiles, then add 1 to the number of files to process } else { // if file cannot be found in allTiles, then add 1 to the number of files to process
let newTile = mapboxLayer(monthYear); let newTile = mapboxLayer(monthYear);
glmap._glMap.addLayer(newTile); glmap.getMapboxMap().addLayer(newTile);
if (monthYear == userFiles[0]) { if (monthYear == userFiles[0]) {
glmap._glMap.setPaintProperty(monthYear, "fill-opacity", 0.7) glmap.getMapboxMap().setPaintProperty(monthYear, "fill-opacity", 0.7)
} }
} }
}); });
...@@ -624,7 +624,7 @@ L.TimeDimension.Layer.Tile = L.TimeDimension.Layer.extend({ ...@@ -624,7 +624,7 @@ L.TimeDimension.Layer.Tile = L.TimeDimension.Layer.extend({
this._timeDimension.off("timeload", this._update, this); this._timeDimension.off("timeload", this._update, this);
//this._baseLayer.getContainer().style.display = "none"; //this._baseLayer.getContainer().style.display = "none";
Object.keys(allTiles).forEach(layer => { // hide all tiles Object.keys(allTiles).forEach(layer => { // hide all tiles
glmap._glMap.setPaintProperty(layer, "fill-opacity", 0); glmap.getMapboxMap().setPaintProperty(layer, "fill-opacity", 0);
}); });
//this.eachLayer(map.removeLayer, map); //this.eachLayer(map.removeLayer, map);
//this._map = null; //this._map = null;
...@@ -664,9 +664,9 @@ L.TimeDimension.Layer.Tile = L.TimeDimension.Layer.extend({ ...@@ -664,9 +664,9 @@ L.TimeDimension.Layer.Tile = L.TimeDimension.Layer.extend({
//console.log(currentTiles) //console.log(currentTiles)
Object.keys(allTiles).forEach(layer => { Object.keys(allTiles).forEach(layer => {
if (layer !== monthYear) { // hide all other months if (layer !== monthYear) { // hide all other months
glmap._glMap.setPaintProperty(layer, "fill-opacity", 0); glmap.getMapboxMap().setPaintProperty(layer, "fill-opacity", 0);
} else { // except current one } else { // except current one
glmap._glMap.setPaintProperty(layer, "fill-opacity", 0.7); glmap.getMapboxMap().setPaintProperty(layer, "fill-opacity", 0.7);
} }
}); });
//console.timeEnd("process"); //console.timeEnd("process");
...@@ -704,7 +704,7 @@ const styleTiles = (option, minIndicators, maxIndicators) => { ...@@ -704,7 +704,7 @@ const styleTiles = (option, minIndicators, maxIndicators) => {
minIndicators[option], scale(minIndicators[option]).hex(), minIndicators[option], scale(minIndicators[option]).hex(),
maxIndicators[option], scale(maxIndicators[option]).hex() maxIndicators[option], scale(maxIndicators[option]).hex()
]; ];
glmap._glMap.setPaintProperty(layer, "fill-color", color); glmap.getMapboxMap().setPaintProperty(layer, "fill-color", color);
}); });
return Promise.resolve(scale); return Promise.resolve(scale);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment