react-map-gl
react-map-gl copied to clipboard
feat: Support for custom mapbox layer
Sometimes it can be handy to insert a visualisation layer under another layer from mapbox (for example under the labels).
To do that, we can use DeckGL's custom mapbox layer that we insert between mapbox own layers.
Since DeckGL's custom layer need methods on the prototype (onAdd, onRemove, render), we cannot copy the layer props with spreading, otherwise we lose the methods. This is why the layer prop is added on the Layer so that we can pass the custom layer without any copying. This is also why there is some rework around beforeId so that it is external to the layer and only part of the Layer component props, not of the layer options props.
I'd like to have your opinion on this way of doing before continuing the work on this PR (maybe improving the documentation or the example).
Thank you for the proposal. To simplify things, I suggest we don't change the prop types for the existing use cases, and just add
type CustomLayer = {
type: 'custom',
layer: CustomLayerInterface
}
What do you think?
Any news on that?
I'm very much interested in seeing this merged. is there a way to help this along?
@Pessimistress @ptbrowne
Was trying to recreate in react-map-gl the example here to display a 3d model, but it looks like this isn't currently possible.
Is there a known workaround for this?
Many thanks!