I have (lat, lon) for the center of a circle.
I have a radius R in km.
My code
for (var i = 0; i < steps; i++) {
let degrees = (i/steps)*360
let radians = (Math.PI/180)*degrees
let x = lat + radius * Math.cos(radians)
let y = lon + radius * Math.sin(radians)
coordinates.push([x,y])
}
returns an oval shape because of the latitude and variable radius is not in km, but in coordinates.
How can I adapt this code in order to generate a perfect circle?