[Bug] Exception when creating pre packed icon layer with deckgl and mapbox, layer is not rendered.
@Pessimistress is already working on this.
Since Mar 18, 2022.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Description
I am using deck.gl with mapbox on angular and having troubles initializing pre packed iconAtlas for IconLayer from this example .
Getting following exceptions when trying to initialize IconLayer
TypeError: initialization of IconLayer({id: 'id-1'}): Failed to execute 'texImage2D' on 'WebGLRenderingContext': Overload resolution failed.
TypeError: drawing IconLayer({id: 'id-1'}) to screen: Cannot read properties of undefined (reading 'getTexture')
Auto packed iconAtlas works as expected as well as scaterplotter layer ( I tested only those 3 so far)
I did some digging and figured out that when I create the layer, iconAtlas is null, even though I assign it during creation.
Also in the draw method of icon-layer.js the iconManager is undefined when trying to get it from the state
const {iconManager: iconManager} = this.state;
const iconsTexture = iconManager.getTexture();
the state object in my case has only attributeManager in it.
here is the sandbox to reproduce.
Flavors
- React
- Python/Jupyter notebook
- MapboxLayer
- GoogleMapsOverlay
- CartoLayer
- DeckLayer/DeckRenderer for ArcGIS
Expected Behavior
The pre packed iconAtlas should work with IconLayer and layer should render without issues.
Steps to Reproduce
on your env.
- create deck.dl and mapbox
- follow this example to create pre packed iconAtlas layer
- add layer to map using layer from an existing deck layer stack, like in this example
On Sandbox
- open the sandbox
- click on
add icon layer pre packed - check the console.
Environment
- Framework version: deck.gl 8.7.0, mapbox-gl.js: 2.7.0, angular: 12
- Browser: chrome 99
- OS: Mac Os 12.2.1
Logs
TypeError: initialization of IconLayer({id: 'id-1'}): Failed to execute 'texImage2D' on 'WebGLRenderingContext': Overload resolution failed.
at eval (texture.js:210:16)
at withParameters (unified-parameter-api.js:60:12)
at Texture2D.setImageData (texture.js:192:47)
at Texture2D.initialize (texture.js:96:10)
at new Texture2D (texture-2d.js:28:10)
at createTexture (texture.js:34:19)
at Object.transform (prop-types.js:66:53)
at LayerState._postProcessValue (component-state.js:189:25)
at LayerState._setPropValue (component-state.js:121:20)
at LayerState._updateAsyncProp (component-state.js:96:10)
at LayerState.setAsyncProps (component-state.js:73:12)
at IconLayer._initState (layer.js:789:24)
at IconLayer._initialize (layer.js:539:10)
at LayerManager._initializeLayer (layer-manager.js:198:13)
at LayerManager._updateSublayersRecursively (layer-manager.js:173:16)
at LayerManager._updateLayers (layer-manager.js:147:10)
at LayerManager.setLayers (layer-manager.js:116:10)
at LayerManager.updateLayers (layer-manager.js:123:12)
at Deck._onRenderFrame (deck.js:549:23)
at AnimationLoop.onRender (animation-loop.js:169:23)
at AnimationLoop._renderFrame (animation-loop.js:237:10)
at AnimationLoop.redraw (animation-loop.js:114:10)
at renderFrame (animation-loop.js:187:12)
at ZoneDelegate.invokeTask (zone.js:402:31)
at Object.onInvokeTask (core.js:18231:25)
at ZoneDelegate.invokeTask (zone.js:401:60)
at Zone.runTask (zone.js:174:47)
at invokeTask (zone.js:483:34)
at ZoneTask.invoke (zone.js:472:48)
at timer (zone.js:2538:29)
TypeError: drawing IconLayer({id: 'id-1'}) to screen: Cannot read properties of undefined (reading 'getTexture')
at IconLayer.draw (icon-layer.js:206:38)
at eval (layer.js:630:14)
at withParameters (unified-parameter-api.js:60:12)
at IconLayer.drawLayer (layer.js:620:46)
at DrawLayersPass._drawLayersInViewport (layers-pass.js:108:17)
at DrawLayersPass._drawLayers (layers-pass.js:32:28)
at DrawLayersPass.render (layers-pass.js:16:17)
at DeckRenderer.renderLayers (deck-renderer.js:42:35)
at Deck._drawLayers (deck.js:519:23)
at afterRender (deck-utils.js:144:12)
at Map.eval (deck-utils.js:65:28)
at Map.fire (mapbox-gl.js:31:22971)
at Map._render (mapbox-gl.js:35:433967)
at eval (mapbox-gl.js:35:438817)
at ZoneDelegate.invokeTask (zone.js:402:31)
at Object.onInvokeTask (core.js:18231:25)
at ZoneDelegate.invokeTask (zone.js:401:60)
at Zone.runTask (zone.js:174:47)
at invokeTask (zone.js:483:34)
at ZoneTask.invoke (zone.js:472:48)
at timer (zone.js:2538:29)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.