-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Support deck.gl extensions
Problem
I've been trying to add terrain draping support to COGLayer using the deck.gl's TerrainExtension but it fails, and it looks like it's because the extensions prop is not automatically forwarded through the complex sublayer hierarchy.
What I Tried
1. Direct Extension on COGLayer (as per the documentation)
const layer = new COGLayer({
// ... other props
extensions: [terrainExtension],
terrainDrawMode: 'drape'
});Nothing happens, but the terrain layer causes some ugly artifacts
2. Layers composition
Created a subclass overriding _renderSubLayers to inject extensions via the experimental _subLayerProps API:
class TerrainAwareCOGLayer extends COGLayer {
_renderSubLayers(props, tms, forwardTo4326, inverseFrom4326) {
const layers = super._renderSubLayers(props, tms, forwardTo4326, inverseFrom4326);
return layers.map(layer => {
if (layer && layer.id && layer.id.endsWith('-raster')) {
return layer.clone({
_subLayerProps: {
'raster': {
extensions: [terrainExtension],
terrainDrawMode: 'drape'
}
}
});
}
return layer;
});
}
}The layer stops rendering altogether. The _subLayerProps API doesn't properly propagate extensions through the RasterLayer -> MeshTextureLayer transition, causing layer initialization to fail.
3. Cloning
Tried passing extensions directly to the cloned RasterLayer:
return layer.clone({
extensions: [terrainExtension],
terrainDrawMode: 'drape'
});Nothing renders
Possible cause
It looks like the extensions prop might not be included in the getSubLayerProps forwarding mechanism:
COGLayer -> TileLayer -> RasterLayer -> MeshTextureLayer
Apparently, CompositeLayer only forwards specific props through getSubLayerProps, and extensions is not in that list.