C
C
cat_crash2013-12-06 10:59:42
Geometry
cat_crash, 2013-12-06 10:59:42

How to describe a circle by a square, given the coordinates of the point and the radius?

Good day.
Help solve the problem in PHP
- There are geo-coordinates of the point (Lat/Lon) and Radius in meters.
How to find the geo-coordinates of a square that describes a circle?
I reread the documentation on converting the Metric system to spherical geocoordinates, but not a single algorithm showed the correct results (tested on Leaflet)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mrrl, 2015-06-17
@Mrl

So you haven't decided? An interesting problem.
Let's assume that the Earth is spherical and its radius is RE. The radius of our circle R, the coordinates of the point are expressed in radians.
Let's define r=R/RE (this is the radius in radians).
The distance from the center of the circle to the vertex of the described square is a=arctg(sqrt(2)*tg(r)) (does a square mean a regular spherical quad?)
Now we need to retreat from our point by a distance a at an angle of 45 degrees to the meridian .
Let P be the north pole, O the center of the circle, A the vertex of the square in the northeast.
Triangle AOP has side length OP=pi/2-Lat, AO=a, angle POA=pi/4. Hence, according to the 1st cosine theorem,
AP=arccos(cos(AO)*cos(OP)+sin(AO)*sin(OP)*cos(AOP))=arccos(cos(a)*sin(Lat)+sqrt(0.5)*sin(a )*cos(Lat)). We get h1=pi/2-AP - the latitude of point A. We
find the APO angle using the sine theorem: sin(APO)/sin(AO)=sin(AOP)/sin(AP), whence APO=d1=arcsin(sin(a )*sqrt(0.5)/cos(h1)). The longitude of point A will be Lon+d1, and the coordinates of the northwestern vertex D will be (h1,Lon-d1).
We do the same with the southern peaks (only there the angle will be 135 degrees):
BP=arccos(cos(a)*sin(Lat-sqrt(0.5)*sin(a)*cos(Lat)), h2=pi/2-BP .BPO
=d2=arcsin(sin(a)*sqrt(0.5)/cos(h2)) The
coordinates of points B and C are (h2,Lon+d2) and (h2,Lon-d2).
, or something else was understood as a square, then more specific conditions are needed.
By the way, if the radius of the circle is greater than a quarter of the equator, then the vertices of the described square will be inside the circle. Such a spherical geometry.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question