Dmitry Bubnenkov
Dmitry Bubnenkov

Reputation: 9859

leaflet how to add circle by coordinates?

Next code is add circle to map:

var mylayer = L.circle([60, 54.75621], 200).addTo(Window.map);

but I want to add coordinates from variable: eq.coordinates

console.log(eq.coordinates);

Print on console: POINT(31.5 42.2)

I want to do something like:

var mylayer = L.circle(eq.coordinates).addTo(Window.map);

Upvotes: 0

Views: 541

Answers (1)

YaFred
YaFred

Reputation: 10008

L.circle wants latlng coordinates.

If you want to use pixel coordinates you have to convert them to latlng coordinates using http://leafletjs.com/reference-1.0.0.html#map-containerpointtolayerpoint

If you could put an example online, this would help helping you

Upvotes: 1

Related Questions