title: Leaflet -- can't change radius on circlemarker on zoom
body: <p>I'm using <a href="http://leafletjs.com/" rel="nofollow">Leaflet</a> to visualize point data and I'm trying to change the radius of circle according to the zoom level.</p>
  
  <p>The more the user is <strong>zoomed in</strong>, the <strong>larger</strong> the radius.</p>
  
  <p><a href="http://pennybeames.net/maps/globalDams.html" rel="nofollow">Work in progress available here.</a></p>
  
  <p>Here's what I have so far.</p>
  
  <p>The first line sets the initial radius:</p>
  
  <pre><code>var damsRadius = 2;
  </code></pre>
  
  <p>Then I have a zoomend event to get the zoom level and then use that zoom level to determine the new radius:</p>
  
  <pre><code>map.on('zoomend', function(e) {
      var currentZoom = map.getZoom();
      console.log("Current Zoom" + " " + currentZoom);
      if (currentZoom &lt;= 6) {
          damsRadius = 2;
      } else {
          damsRadius = 6;
      }
      console.log("Dams Radius" + " " + damsRadius);
  });
  </code></pre>
  
  <p>I set the radius as part of the style object:</p>
  
  <pre><code>function damsStyle(feature) {
      return {
        fillOpacity: 0.8,
        fillColor: getColor(feature.properties.mainuse),
        weight: 1,
        opacity: 1,
        color: '#e0e0e0',
        radius: damsRadius // HERE IS WHERE I SET THE RADIUS
      };
  }
  </code></pre>
  
  <p>and then add the whole kit to the map using  <code>pointToLayer</code> later on:</p>
  
  <pre><code>pointToLayer: function (feature, latlng) {
      return L.circleMarker(latlng, damsStyle(feature));
  } 
  </code></pre>
  
  <p>Everything works swimmingly according to the console. Zooming in and out shows that the value for <code>damsRadius</code> is changing as expected.</p>
  
  <p>The trouble is, though, the <strong>radius</strong> of the points on the map doesn't change. So, somewhere along the way something isn't getting communicated. </p>
  
  <p>I tried the same trick with <code>L.circle</code> but it didn't work either. Do I need to use <code>clearLayers</code> function and <strong>redraw</strong> every time I change the zoom level? </p>
  
  <p>That seems a bit excessive.</p>
  
  <p>Advice?</p>