Re: Querying distances between two coordinates

From: Mladen Gogala <no_at_email.here.invalid>
Date: Fri, 10 Jun 2011 16:37:16 +0000 (UTC)
Message-ID: <pan.2011.06.10.16.37.15_at_email.here.invalid>



On Fri, 10 Jun 2011 17:15:05 +0100, Jeremy wrote:

> Hi this is a 10gR2 Standard Edition question.
>
> The requirement is to be able to calculate the distance between two co-
> oordinates expressed as latitude and longitude.

dist=sqrt(power(x2-x1,2)+power(y2-y1,2));

>
> Q1) How would the latitude and longitude be stored in an Oracle table
> (what data types)?

As ordered pairs of coordinates.

>
> Q2) What would an example query look like?

See above.

>
> Q3) Is this even possible with 10gR2 Standard Edition?

Yes.

>
> Just to be clear (!) this is the sort of simplistic representation I
> guess
>
> item lat long
> ---- --- ----
> P1 50.716667 -1.883333 P2 51.023332
> -1.872231
>
> The format of the lat/long are as I have been informed they are recorded
> in a remote system with which we are needing to integrate.
>
> I would want to be able to calculate the straight line distance between
> P1 and P2.
>
> Thanks for any pointers!

The first pointers were given by certain guy named Pitagoras. For quite some time, he has been a bane and a terror of many high school children around the world. If it was up to me, I'd send the seal team 6 to dispatch him. Unfortunately, he's not on any terror lists, a grave omission if you ask me.

-- 
http://mgogala.byethost5.com
Received on Fri Jun 10 2011 - 11:37:16 CDT

Original text of this message