Dmitry Shulga
Dmitry Shulga

Reputation: 618

How to get coordinates of circle in the JS Leatflet-draw plugin

This question about JS, the library Leaflet.js and plugin Leaflet-draw.

how can I get coordinates of circle (radius)? For instance, getting coordinates (the first point) of rect, polygon, etc I'm using this:

var a = layer.getLatLngs(); 
arrY[i] = a[0].lat; 
arrX[i] = a[0].lng;

But for circle it isn't working. Help me please. Sorry for my eng yet once

Upvotes: 1

Views: 2039

Answers (1)

pk.
pk.

Reputation: 986

Check out the leaflet circle reference for all of the available items.

Sounds like you are looking for getLatLng() and getRadius() for your immediate need.

var latLng = layer.getLatLng();
var radius = layer.getRadius();

Upvotes: 4

Related Questions