Created
April 6, 2018 10:22
-
-
Save rozklad/f37d1236e32f4740a18f2634b229ab10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wait for load | |
map.on('load', () => { | |
axios.get('https://gist.githubusercontent.com/rozklad/49d5ca8a7fbd0173e191820994448690/raw/3c2c1b230b6e32f7fba4848a9fba95465d5d90b1/migration-1990-2017.json') | |
.then((response) => { | |
// Store response in geoData | |
geoData = response.data; | |
// Base layer with countries data | |
map.addLayer({ | |
id: 'countries', | |
source: { | |
type: 'geojson', | |
data: response.data, | |
}, | |
type: 'fill', | |
paint: { | |
'fill-color': '#3B8C9B', | |
'fill-opacity': 1, | |
'fill-outline-color': '#0a0a0a', | |
}, | |
}); | |
// Hovering over countries | |
map.addLayer({ | |
id: 'countries-hovered', | |
source: { | |
type: 'geojson', | |
data: response.data, | |
}, | |
type: 'fill', | |
paint: { | |
'fill-color': '#3B8C9B', | |
'fill-opacity': 1, | |
'fill-outline-color': '#0a0a0a', | |
}, | |
filter: ['in', 'name', ''], | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment