# Drawing circumference issue

I'm a developer, and I'm developing an app on Google Maps. At the moment, I'm trying to draw a circle on the map.

For getting all the points I need, I'm using the following formula:

$$y=y_c\pm\sqrt{r^2-(x-x_c)^2}$$

but I get an ellipse, not a circle.

Did I mistake the formula?

Or I need to search the error in my code?

UPDATE I found that I have to draw an ellipse, because of the different axis scale. At the moment I can find four correct points (north, east, south, west).

• At 45 degrees north longitude lines are much closer together than latitude lines. Perhaps this is what is compressing your circle horizontally. – jbuddenh Jul 21 '15 at 15:36
• A problem that also Andreas Blass noticed. I suppose that now I need to work with an ellipse. I have an update: I can get four points (north, south, east, west) and they are all correct. Now, can I get the right equation of the ellipse, by using these four points? Do I need more or less points? – studente100 Jul 21 '15 at 15:54
• You have enough with three points, giving the center and the half-axis lengths. $\frac1{a^2}(x-x_c)^2+\frac1{b^2}(y-y_c)^2=1$. – Yves Daoust Jul 21 '15 at 16:23
• This is also relevant: Discretize a circle on a sphere with a given center and radius (but it may be more than you need for your application). – David K Jul 21 '15 at 19:28
• About the last comment, yes, maybe it's something more. I will try your formula, I suppose I have to solve a system of three of these equations. I will put the center, and two other points I found. – studente100 Jul 22 '15 at 7:20

On the picture I measure that the ellipse is about $482\times689$ pixels, i.e. has an aspect ratio of $0.7$, which corresponds to a latitude of $45.6°$. The true latitude of Milano is $45°28'=45.46°$. Not so bad...
The general equation of an circle is $(x-x_c)^2+(y-y_c)^2=r^2$. This can be rewritten to your equation. I think that there is a mistake in your code. In particular, check whether you don't divide of multiply $x$ by anything, that will result in an ellipse.