0

I want to decrease the size of the image when the zoom level of the map is decrease . How can I achieve this? Here I want zoom image equal to map zoom level Thanks in advance

map.value.map.on('load', () => {
// Load an image from an external URL.
  map.value.map.loadImage(
  'https://docs.mapbox.com/mapbox-gl-js/assets/cat.png',
  (error, image) => {
  if (error) throw error;
  
  // Add the image to the map style.
  map.value.map.addImage('cat', image);
  
  // Add a data source containing one point feature.
  map.value.map.addSource('point', {
  'type': 'geojson',
  'data': {
  'type': 'FeatureCollection',
  'features': [
  {
  'type': 'Feature',
  'geometry': {
  'type': 'Point',
  'coordinates': [-112.1, 33.5]
  }
  }
  ]
  }
  });
  
  // Add a layer to use the image to represent the data.
  map.value.map.addLayer({
  'id': 'b7',
  'type': 'symbol',
  'source': 'point', // reference the data source
  'layout': {
  'icon-image': 'cat', // reference the image
  'icon-size': ['interpolate', ['linear'], ['zoom'], 0.5, 15, 1, 10]
  }
  });
  }
  );
  });

Shark
  • 131
  • 6

0 Answers0