Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Find a location given approximate latitude and longitude near the location
Luke Airig wrote:
> I have a gps-related Oracle problem that I can use some help with.
>
> Here is the scenario that I am trying address in Oracle 8.1.7.4:
>
> I have the following tables with latitude and longitude stored in decimal
> degrees:
>
> 1. Bus stops along with their exact latitude and longitude.
> 2. Bus riders along with the approximate latitude and longitude of where
> they boarded a bus. I cannot assume that I will have the exact
> coordinates, only a reasonably close approximation.
>
> Can anyone help me with a solution that, given the latitude and longitude
> where a rider boarded, will return the bus stop where they boarded? The
> coordinates where the rider boarded will be guaranteed to be within a specified
> distance of the bus stop latitude and longitude.
>
> This problem is outside the day-to-day programming issues that I normally deal
> with and I am woefully deficient in the math department. I'm totally at a loss
> as to where to begin, so specific calculations, formulas, sql and/or PL/SQL code
> will earn you my vote for a spot in heaven. :) In any case, ANY help or advice
> on how to proceed is much appreciated.
>
> TIA
Go to http://www.drmath.com. The site contains a lot of solutions for
lat-long problems and conversions. One thing to be careful of is that
some solutions work for short distances on a curved surface, such as
yours and others are intended for global solutions and the differences
can be significant. Also be careful with any rounding.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Sun Nov 16 2003 - 16:42:26 CST