react-map-gl icon indicating copy to clipboard operation
react-map-gl copied to clipboard

feat: Support for custom mapbox layer

Open ptbrowne opened this issue 3 years ago • 6 comments

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).

ptbrowne avatar May 02 '22 08:05 ptbrowne

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?

Pessimistress avatar May 11 '22 19:05 Pessimistress

Any news on that?

sven-meyer-wetter-com avatar Jan 02 '23 12:01 sven-meyer-wetter-com

I'm very much interested in seeing this merged. is there a way to help this along?

Reichenberg avatar Apr 17 '23 09:04 Reichenberg

@Pessimistress @ptbrowne

Reichenberg avatar Apr 17 '23 09:04 Reichenberg

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!

stampycode avatar Oct 14 '23 17:10 stampycode