Created
August 15, 2022 13:25
-
-
Save ostermanj/c8302e49e9b83b83a05bd2e964d92fba to your computer and use it in GitHub Desktop.
mbHelper addSourceAndLayers() example
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
mbHelper.addSourceAndLayers.call(map, | |
{ // source | |
"type": "vector", | |
"url": "mapbox://mapbox.us_census_states_2015", | |
"name": "states" | |
}, [ // layers | |
{ // layer one | |
"id": "states-join", | |
"type": "fill", | |
"source-layer": 'states', | |
"paint": { | |
"fill-color": 'transparent' | |
}, | |
"beforeLayer": "water" // <== this is different from mapbox native specs | |
}, | |
{ // layer two | |
"id": "states-join-hover", | |
"type": "line", | |
"source-layer": 'states', | |
"paint": { | |
"line-color": '#4D90FE', | |
"line-width": 4, | |
"line-blur": 2 | |
}, | |
"filter": ["==", "name", ""] | |
} | |
]).then(() => { | |
// do some stuff | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment