1 year ago
#222871
Anaphory
What causes ‘Model needs a program’ with a DataFilterExtension?
Following the advice in an answer to my last question, I added a deck.DataFilterExtension
to my deck.gl GeoJSON-layer to be able to filter some polygons. The following is the core of my setup; I hope I'm not leaving out any important details by shortening it.
<script>
let highlightedMap = null;
render();
function render() {
layers = [new deck.GeoJsonLayer({
id: 'polygon-layer',
data: family,
pickable: true,
getPosition: d => d.geometry.coordinates,
filled: true,
getFillColor: d => (visibility(d) ? hexToIntColor(d.properties.color) : [0, 0, 0, 0]),
lineWidthUnits: "pixels",
getLineWidth: highlighted,
getLineColor: highlightedColor,
lineWidthMinPixels: 1,
visible: true,
onClick: displayProperties,
updateTriggers: {
getLineWidth: [highlightedMap],
getLineColor: [highlightedMap],
getFillColor: [highlightedMap],
getFilterValue: [highlightedMap]
},
getFilterValue: visibility,
filterRange: [1, 2],
filterEnabled: false,
extensions: [new deck.DataFilterExtension({filterSize: 1})]
})];
deckgl.setProps({layers});
}
</script>
<!-- Libraries in the end for faster page loading-->
<script src="https://unpkg.com/deck.gl/dist/dist.dev.js"></script>
<script src="https://unpkg.com/@deck.gl/carto/dist/dist.dev.js"></script>
<script src='https://unpkg.com/@turf/turf@6/turf.min.js'></script>
<link href="https://libs.cartocdn.com/mapbox-gl/v1.13.0/mapbox-gl.css" rel="stylesheet" />
<script src="https://libs.cartocdn.com/mapbox-gl/v1.13.0/mapbox-gl.js"></script>
Initially, visibility
returns 0 and nothing is rendered despite the filterEnabled: false
, but after a user interaction, it returns 1 or 2 for some polygons so things should definitely appear, but instead, I see on the console
Error: update of PathLayer({id: 'polygon-layer-polygons-stroke'}): Model needs a program
assert https://unpkg.com/deck.gl/dist/dist.dev.js:45267
_checkProgram https://unpkg.com/deck.gl/dist/dist.dev.js:27146
initialize https://unpkg.com/deck.gl/dist/dist.dev.js:26814
Model https://unpkg.com/deck.gl/dist/dist.dev.js:26774
_getModel https://unpkg.com/deck.gl/dist/dist.dev.js:105017
[...]
both for the polygon fill and for the polygon strokes. I cannot make head or tails of this, especially because to my JavaScript-untrained eyes, program
actually appears to be a WebGLProgram.
Things are fine, everything shows up nicely, without the filter-specific lines
getFilterValue: [highlightedMap]
},
getFilterValue: visibility,
filterRange: [1, 2],
filterEnabled: false,
extensions: [new deck.DataFilterExtension({filterSize: 1})]
What could be going wrong here?
deck.gl
0 Answers
Your Answer