Re: Querying distances between two coordinates

From: Jeremy <jeremy0505_at_gmail.com>
Date: Sat, 11 Jun 2011 15:21:12 +0100
Message-ID: <MPG.285d8a2ee3acc1ff98990b_at_News.Individual.NET>



In article <b603279c-b4df-479f-ad9e-
5c063f34b8ce_at_z37g2000vbl.googlegroups.com>, hurleyjohnb_at_yahoo.com says...
>
> On Jun 10, 12:15 pm, Jeremy <jeremy0..._at_gmail.com> 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.
> >
> > Q1) How would the latitude and longitude be stored in an Oracle table
> > (what data types)?
> >
> > Q2) What would an example query look like?
> >
> > Q3) Is this even possible with 10gR2 Standard Edition?
> >
> > 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!
> >
> > --
> > jeremy
>
> This sounds suspiciously like homework but if I were you I would do
> some research on Oracle Spatial perhaps.

Not sure why it sounds like homework, I am aware of "spatial" otpions and "locator" but havent used them before.
>
> If lat and long are numbers then ... geez ... wonder what data type
> would be used?

Well actually the question is because I have usually seen lat/long expressed in degrees minutes and seconds but as you can see these are numbers (and I kinda figured that I might just be able to store those in a number column)...

>
> When in doubt try http://asktom.oracle.com ...

Have done many a time. But I also find this an excellent ng where people are happy to share their knowledge.

-- 
jeremy
Received on Sat Jun 11 2011 - 09:21:12 CDT

Original text of this message