vue-mapbox icon indicating copy to clipboard operation
vue-mapbox copied to clipboard

Setting a layout on addLayer is ignored

Open tb4764 opened this issue 4 years ago • 0 comments

I'm trying to add a GeoJson source and a symbol layer with some layout properties. The source and layer are added, but the layout options are not implemented.

map.addSource('newSource', {
        'type': 'geojson',
        'data': {
              "type": "FeatureCollection",
              "features": [
                    {
                           "type": "Feature",
                           "geometry": { "type": "Point", "coordinates": [0, 0] },
                    }
              ]
        }
})
map.addLayer({
            'id': 'newLayer',
            'type': 'symbol',
            'source': 'newSource',
            'layout': {
                'icon-image': 'arrow',
                'icon-size': 10
            }
        })

When I track the map layers (map.getStyle().layers) in the console, the added layer only has the following:

id: "newLayer"
source: "newSource"
type: "symbol"

I tried this in a simple HTML file (without Vue & vue-maxpbox), and it works fine (ie, the layout properties are applied and visible in the console). Any idea?

tb4764 avatar May 10 '21 17:05 tb4764