Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fordecyt_2019
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
fordecyt_2019
Commits
9bd35625
Commit
9bd35625
authored
Sep 06, 2019
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update mapbox map getter
parent
50a9afdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
grijalva_functions.js
public/fordecyt_2019/js/grijalva_functions.js
+9
-9
No files found.
public/fordecyt_2019/js/grijalva_functions.js
View file @
9bd35625
...
@@ -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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment