populate iconSize depending on property in Mapbox

303 Views Asked by At

I have the following style:

  iconImage: ['get', 'icon'],
  iconSize: ['interpolate', ['exponential', 2], ['zoom'], 15, 0.02, 23, 3],
  iconAllowOverlap: true

I want to apply a different icon size from every kind of point without having to manually divide them into categories or change the size of the images. In other words, I want to populate iconSize depending on a property of the point (type).

I have features like this:

{
                type: 'Feature',
                id: entity.uuid,
                properties: {
                  title: entity.name,
                  name: entity.name,
                  type: entity.type,
                  variation: entity.variation,
                  icon: getNameFromVariation(entity.name, entity.variation),
                },
                geometry: {
                  type: 'Point',
                  coordinates: [entity.coordinate[0], entity.coordinate[1]],
                },
              }

I want to change the interpolation max size depending on the type property.

How can I achieve this? Any hint would help. Thank you in advance.

0

There are 0 best solutions below