Get beginning, end co-ordinates & radius of circle drawn in leaflet.js
▼1 up and 0 down, posted by
1 up and 0 down, posted by
Hi, trying to work out the code for the co-ordinates at the beginning of drawing a circle, the end of having drawn the circle as well as the radius of the circle in leaflet.js and want to print the results to the console. So far I have the following but cannot work out how to do precisely the beginning, end and radius of circle:
----------------------------------
map.on('draw:created', function (e) {
var type = e.layerType;
var layer = e.layer;
var latLngs;
if (type === 'circle') {
latLngs = layer.getLatLng();
console.log("Coordinates: " + latLngs.toString());
}
else
latLngs = layer.getLatLngs(); // Returns an array of the points in the path.
// process latLngs as you see fit and then save
})
------------------------------------------------------
Any ideas how to do this?