Skip to main content
Tweeted twitter.com/StackGIS/status/1278659701962616833
edited title
Link
BBG
  • 5.9k
  • 5
  • 48
  • 88

Leflet Leaflet js style geojson layer according to zoom level

added 658 characters in body
Source Link
Nico P
  • 53
  • 1
  • 4

Second approach inspired by Stephen's answer @Stephen Lead

 function style(feature) { var fa; return { color: getColor(feature.properties.paP), weight: fa * getWidth(feature.properties.stW), opacity: 0.6, lineCap: 'square', lineJoin: 'square', }; } map.on('zoomend', function () { var currentZoom = map.getZoom(); if (currentZoom <= 16) { fa = 0.5; } else { fa = 3; } }); 

Second approach inspired by Stephen's answer @Stephen Lead

 function style(feature) { var fa; return { color: getColor(feature.properties.paP), weight: fa * getWidth(feature.properties.stW), opacity: 0.6, lineCap: 'square', lineJoin: 'square', }; } map.on('zoomend', function () { var currentZoom = map.getZoom(); if (currentZoom <= 16) { fa = 0.5; } else { fa = 3; } }); 
edited tags
Link
Nico P
  • 53
  • 1
  • 4
Loading
Source Link
Nico P
  • 53
  • 1
  • 4
Loading