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

Update 'paint' option of added Layer?

Open butaminas opened this issue 4 years ago • 2 comments

I'm looking for a way to update the circle-radius (inside paint) of already created Layer.

I can't seem to find any API for that and no examples either.

Is the only way currently to do so is to delete the old layer and create a new layer?

Thanks.

butaminas avatar Dec 16 '20 14:12 butaminas

Currently that is your only option. I'll add that possibility soon, as it's a minor addition but a very useful one.

cvietor avatar Dec 18 '20 05:12 cvietor

Hi @butaminas

I've just opened a new PR #42 that makes it possible to set and get the layer properties.

After the PR is merged, you can set the 'circle-radius' property like below:


const layer = await this.mapbox.getLayer('myCircleLayer');
layer.setProperty('circle-radius', ['get', 'radius']);

KG3RK3N avatar May 21 '21 17:05 KG3RK3N