# Lat/Lon Coordinates of a Circle on a Sphere

I've a similar problem as talked about in this question: Circle On Sphere

I also need a set of formulas which give me the coordinates of a circle on a sphere (something like $x = \sin(t)$, $y = \cos(t)$ for $t \in [0, 2\pi )$). But I do not need Cartesian coordinates (x, y) but latitude and longitude.

I could, of course, use the answer from the question linked above and then convert the x,y,z points I get back into latitude and longitude values (using arctan(), etc). This sounds complex and I've got the feeling that there might be a more clever way of avoiding the Cartesian coordinates, i. e. I guess there are formulas which directly spit out latitudes and longitudes for $t \in [0, 2\pi)$.

Is there such a "shortcut" available?

• Are you interested in great circles only, or....? If "yes" then Clairaut's relation gives some information. – Jyrki Lahtonen Dec 1 '17 at 11:14
• No, I want to draw on a map the circle of a 10km (or 300km or 4000km) radius around, e. g. Mount Everest, or Berlin, or the north pole (the last would be simple of course). For "drawing" I need to have lat/lon coordinates which I then put in a KML file to display with Google Earth or any other GIS tool. – Alfe Dec 1 '17 at 12:23
• A trigonometric approach had led me to the following. Let $S=\{(x,y,z)\in\Bbb R^3: x^2+y^2+z^2=1\}$ be the unit sphere with the spherical coordinates Lat/Lon parametrisation $x=\sin\varphi\cos\psi$, $y=\cos\varphi\cos\psi$, and $z=\sin\psi$ ($-\pi/2\le\varphi\le\pi/2$, $-\pi<\psi\le\pi$). Let $C$ be the circle on $S$ and $n=(n_x,n_y,n_z)$ be a vector orthogonal to a plane containing circle $C$. There exists a constant $d$ such that $C=\{(x,y,z)\in S: n_xx+n_yy+n_zz=d\}$. Thus we have to find a (parametric) solution of an equation $n_x\sin\varphi\cos\psi+n_y\cos\varphi\cos\psi+n_z\sin\psi=d.$ – Alex Ravsky Dec 1 '17 at 14:17
• Put $n_1=\sqrt{n_x^2+n_y^2}$. If $n_1=0$ then to $C$ is described by an equation $\psi=\operatorname{const}$. Otherwise let $\varphi_0$ be an angle such that $n_x/n_1=\cos\varphi_0$ and $n_y/n_1=\sin\varphi_0$. Then $n_1\sin(\varphi+\varphi_0)\cos\psi+ n_z\sin\psi=d$. Put $n_2(\varphi)=\sqrt{n_1^2\sin^2(\varphi+\varphi_0)+n_y^2}$. If $n_z\ne 0$ then let $\psi_0$ be an angle such that $n_z/n_2(\varphi)=\cos\psi_0$ and $n_1\sin(\varphi+\varphi_0)/n_2(\varphi)=\sin\psi_0$. Then $n_2(\varphi)\sin(\psi+\psi_0)=d$. – Alex Ravsky Dec 1 '17 at 14:17

A handy formula for the great-circle distance between two points in spherical coordinates, one at latitude $\theta$ and longitude $\phi$ and the other at latitude $\theta_0$ and longitude $\phi_0,$ measuring latitude from $-\frac\pi2$ to $\frac\pi2,$ is $$d=2\sin^{-1}\sqrt{\sin^2\frac{\theta-\theta_0}2 + \cos\theta\cos\theta_0 \sin^2\frac{\phi-\phi_0}2},$$ where $d$ is the great-circle distance measured in units such that the sphere's radius is $1$ (adapted from Aviation Formulary V1.46 by Ed Williams with some renaming of variables).

The range of latitudes used in this formula is due to the fact that it is intended for navigation in conventional geodetic coordinates on the Earth, converting the degrees of latitude and longitude to radians but not doing the extra transformations that would be required to make latitude range from $0$ to $\pi.$ If you prefer a latitude that ranges from $0$ to $\pi$ the formula would need some adjustment (specifically, change $\cos\theta\cos\theta_0$ to $\sin\theta\sin\theta_0$).

Take $(\theta_0,\phi_0)$ as the center of a small circle, $d$ as the radius (measured along the surface of the sphere) of the circle, and $(\theta,\phi)$ as any point on the circumference. For simplicity of the mathematics, let's assume angles are measured in radians. Assuming the radius of the small circle is less than the distance from the center to a pole, we can easily see that the minimum and maximum values of $\theta$ occur when $\phi = \phi_0$: $\theta_\min = \theta_0 - d$ and $\theta_\max = \theta_0 + d.$ If the small circle is closer to a pole, however, we need to do some further operations to get minimum and maximum latitudes that are in the correct range. For example, assuming that one pole of the sphere is at latitude $\frac\pi2,$ if $\theta_0 + d > \frac\pi2$ we take $\theta_\max = \pi - (\theta_0 + d).$

Once we have established the correct interval of values of $\theta$ that can be the latitudes of points on the small circle, we can choose any $\theta$ in that interval and solve for $\phi$: $$\phi = \phi_0 \pm 2\sin^{-1}\sqrt{\frac {\sin^2\frac d2 - sin^2\frac{\theta-\theta_0}2} {\cos\theta\cos\theta_0}},$$

It's up to you to decide whether that's preferable to finding Cartesian coordinates $(x,y,z)$ for points on the circle and then converting them to spherical coordinates. (For one thing, the solution above is parameterized by latitude and not by direction from the center of the circle as is done in Circle On Sphere.)

• Though technically exactly what I asked for, this solved my issue. It was now easy to compute a $\theta$ by oscillating it between the minimum and maximum possible latitude and get the corresponding $\phi$ with the formula you provided! – Alfe Dec 7 '17 at 12:33

A numerical solution is given with $\theta$ as a parameter and as well as independent variable. $\psi$ is variable angles made by small circle with meridians rotating between north and south poles, $\phi$ is co-latitude, $\gamma$ is complement to angle of small circle cone axis vector to north-south pole symmetry axis, $\gamma=0$ for great circle/geodesic.

$$\dot{\phi} = - \cos \phi \cot \psi; \quad (\dot{\psi}+\sin \phi) \sin \psi = \cos \phi \tan \gamma ;$$

(Dots are differentiation w.r.t. $\theta)$

for some arbitrary constants assumed at $\theta=0.$ It produces a small circle graphic:

Towards finding an analytical relation the co-latitude $\phi$ and $\psi$ are functions of $\theta$ in the above differential equation, seen to be coupled as $$\tan \gamma\, \dot{\phi}= (\dot \psi+ \sin \phi) \cos \psi;$$

The small circles are tangent to two circles of unequal radius, there is no Clairaut constant. (It varies from north to south poles.)

• That's an interesting approach, thanks for contributing this! – Alfe Dec 7 '17 at 10:01