kuanb
kuanb

Reputation: 1698

Scale circleMarker in Leaflet

When you create a circle in Leaflet, you can designate a width that scales (that is when you are zoomed out, the circle is "smaller" keeping in scale with the site it covers).

When you create a circleMarker, the result is a circle that does not scale. How does one make the circleMarker scale like the standard circle?

If not possible, how does one create a layerGroup of circles to achieve the same desired affect?

Upvotes: 1

Views: 2517

Answers (2)

Tomy
Tomy

Reputation: 247

In leaflet circleMarker function have fix radius with any zoom if you want change radius circle use {radius: 50.4} or if want change weight border circle use {weight:12} like this https://jsfiddle.net/magi2109/6btw7zg8/5/

enter image description here

Upvotes: 1

Alexander Parshin
Alexander Parshin

Reputation: 196

L.CircleMarler has fixed radius in pixels for any zoom.

But you can create L.layerGroup for any class, that implements ILayer interface including L.Circle. For example:

L.layerGroup([L.circle([0, 0], 200000), L.circle([50, 50], 400000)]).addTo(map);

Upvotes: 1

Related Questions