Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mbHelper addSourceAndLayers() example
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