JoshQuake
JoshQuake

Reputation: 109

Leaflet - circleMarker not applying color tag

I am creating a map for a game and I placed a bunch of circleMarkers, but they aren't changing colour based on the color or fillColor tags.

var Tenaland = L.circleMarker([-417, 385.0625], 45, {
color: '#f03',
fillColor: '#f03',
fillOpacity: 0.80
}).addTo(map);

They are defaulting to blue.

Upvotes: 0

Views: 1127

Answers (1)

ghybs
ghybs

Reputation: 53185

I believe you use an incorrect signature for L.circleMarker. The second argument is for the options, not for a radius.

var Tenaland = L.circleMarker([-417, 385.0625], /*45,*/ {
    color: '#f03',
    fillColor: '#f03',
    fillOpacity: 0.80
}).addTo(map);

Then you can change its size using the .setRadius(pixels) method.

It is for L.circle that the 2nd argument defines the radius (in meters).

Upvotes: 2

Related Questions