0

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.

dclipca
  • 1,739
  • 1
  • 16
  • 51
  • I'm not really sure what you're asking. Can you give examples of a couple of your data points and what `iconSize` you want to be calculated for them? – Steve Bennett Sep 09 '20 at 06:56
  • That didn't really answer the question. What are the values of `type`, and what do you want them to map to? – Steve Bennett Sep 09 '20 at 11:32
  • ```type``` is a string. I have more than 10 types. For every type, I want to have a different ```iconSize```. Essentially I want to map the ```type``` to ```iconSize``` – dclipca Sep 09 '20 at 12:18
  • Can you include actual examples of these types, and how you calculate sizes from them? I don't really understand your constraint of "without having to manually divide them into categories". What part are you actually stuck with? – Steve Bennett Sep 10 '20 at 04:02
  • So I have objects (in the physical sense): trees, buildings, etc. Some trees are bigger than building so I want to make them smaller programmatically. This is why I want to map the type of the object (say tree) to a fixed iconSize. – dclipca Sep 10 '20 at 16:14
  • Right now I am simply changing the size of the icons but this is not an ideal solution because of retina screens. – dclipca Sep 10 '20 at 16:15
  • Please include actual examples of your data. This is the third time I'm asking. – Steve Bennett Sep 11 '20 at 02:03

0 Answers0