0
votes

I'd like to style points on my map as follows:

'circle-radius': {
  property: 'pixelRadius',
  stops: [
    [0, 0],
    [20, 'pixelRadius'],
  ],
  base: 2,
}

The use case is similar to Drawing a circle with the radius in miles/meters with Mapbox GL JS

Except that in my properties map I have computed the pixel radius so that each point in the FeatureCollection has its own radius.

Can this be done? All of the examples Ive seen with stops have a hard coded value for the 2nd array element.

1

1 Answers

1
votes

Try this:

'circle-radius': [
    "interpolate",
    ["exponential", 2],
    ["zoom"],
    0, 0,
    20, ['get', 'pixelRadius']
],

So here it is using expression (https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-get) instead of function.