Skip to content

Cannot add custom layer #849

Description

@jvntf

Version: 5.0.0
Problem: I am unable to add a custom layer to a map (using StaticMap) inside of a DeckGL framework. I get an error that a source must be specified and that type: custom is not supported

class threeJSModel{
        constructor(){
          this.id='custom_layer';
          this.type='custom';
          this.renderingMode = '3d'
        }
        onAdd(map, gl) {
            //create 3JS scene here
        }

        render(gl, matrix) {
            //render the scene
        }
    }

and then I add it to the map as follows:

const mapStyle = defaultMapStyle
      .set('layers', defaultMapStyle.get('layers').push(fromJS(new threeJSModel())))
this.setState({mapStyle})
<StaticMap
             ref = {this._mapRef}
             reuseMaps
             mapStyle={this.state.mapStyle}
             preventStyleDiffing={true}
             mapboxApiAccessToken={MAPBOX_TOKEN}
           />
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions