[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Geographic math problem
From:       "David T. Ashley" <dashley () gmail ! com>
Date:       2007-06-28 22:25:16
Message-ID: dbf695bf0706281525l704325cref118a60220d9036 () mail ! gmail ! com
[Download RAW message or body]


On 6/28/07, M5 <m5@renefournier.com> wrote:
>
> Not being very strong at math, I have a little problem that I'm not
> sure how to solve. Maybe someone can help me.
>
> Basically, given a point (latitude, longitude) and a radius (100
> meters) (think circle), I need to compute an equivalent square: That
> is, two points that would correspond to two corners of the square.
>
> From:   51, -114                        100 meters
> To:             51.005, -114.005        NE corner
>                49.995, -113.995        SW corner
>
> Now, the above is not really accurate, of course, since the earth is
> spherical (well, at least most people think so), and I would like
> this computation to run in MySQL query, e.g.:
>
> UPDATE places SET ne_latitude = (*), ne_longitude = (*), sw_latitude
> = (*), sw_longitude = (*)
>
> In the above table, there are already three columns with the centre
> latitude and longitude and radius. Any ideas? Thanks.


The math of latitude and longitude ain't too bad.

Consulting a globe would help.

A degree of latitude is always the same size in terms of the distance along
the earth's surface.  However, a degree of longitude varies in size--longest
at the equator and shortest (actually zero) at the poles.  The defining
equations come from that.

Just a few notes:

a)Whatever equations you derive for the corners may break down if the area
includes either pole.  You will need to guard against that.

b)My gut tells me that you can come up with some very simple approximations
(sine of this times cosine of that or dimension of the square) that will
work so long as the dimensions of the square are much smaller than the
diameter of the earth and you're not working too close to the poles.
However, if you mark up a spherical surface (such as a basketball or
beachball), I think you'll see that the relationships if either of those
assumptions break down would have to go to higher-order equations and
wouldn't be so simple, even if they can be represented in closed form.

If you want the exact relationships (which I don't believe are in the URLs
cited), you should probably post to sci.math.

Dave.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic