mapbox-gl-js version: 0.22.1
JS Bin: http://jsbin.com/heguxesiwu/4/edit?html,output
n.b. Discovered while attempting to replicate this example.
The following block should create some outlines (NYC boroughs).
map.on('load', function() {
map.addSource("boroughs", {
"type": "geojson",
"data": "https://raw.githubusercontent.com/dwillis/nyc-maps/master/boroughs.geojson"
});
map.addLayer("borough-fills", {
"id": "borough-fills",
"type": "fill",
"source": "boroughs",
"layout": {},
"paint": {
"fill-color": "#627BC1",
"fill-opacity": 0.5
}
});
});
The geojson fails to load, is not parsed to JSON, or breaks some other way and the map freezes/breaks.
TypeError: Cannot use 'in' operator to search for 'ref' in borough-borders(…)fire @ evented.js:92_render @ map.js:1059
Human Error: Bad call to map.addLayer
Correct call
map.addLayer({
"id": "borough-fills",
"type": "fill",
"source": "boroughs",
"layout": {},
"paint": {
"fill-color": "#627BC1",
"fill-opacity": 0.5
}
});
Most helpful comment
Human Error: Bad call to
map.addLayerCorrect call