3

I was under the impression that L.circle changes size with zoom, but L.circleMarker should remain the same radius as you initially set?

I've setup an example here, and whichever I choose the circle always changes size on zoom. What am I missing?

http://jsfiddle.net/qmL8ej19/

(double click to add circle marker)

  • The example in jsFiddle is no longer working, please update it. – Mahdi Alkhatib Jul 26 '17 at 12:07
4

Both will appear to change size as you zoom, depending on your reference: L.circleMarker will change size relative to the map, but not relative to the screen (radius in screen pixels stays the same). L.circle will change size relative to your screen, but not the map, as you zoom (radius in map units stays the same).

For me, it works as expected in your fiddle. If I add a circle instead of a circle marker, it does not change size (relative to the map) on zoom:

var circle = L.circle([click.lat, click.lng], 50000).addTo(map);
  • Ah I think my issue was using much smaller radius for circle! Adding such a huge radius gives the desired effect. Thank you! – Titan Aug 25 '15 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.