Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> longitude, latitude
Hello all,
Looking for some advice on the best way to use longitude and latitude. These values are stored in a table, along with other info.
In order to get within a certain distance, our developers are using the following query. It actually runs well, with a few hints. I feel that we need to narrow down the long/lat in the where clause by a certain distance.
I'll be the first to admit I don't know much about long/lat. I'm just trying to tune this query a bit.
Anybody else out there deal with this before?
SELECT DISTINCT service_provider_id,
SQRT(((37.6715 - LATITUDE)*(37.6715 - LATITUDE) + (-77.5465 -
LONGITUDE)*(-77.5465 - LONGITUDE)) * 5329) DIST
FROM provider_search
WHERE SPECIALTY_CATEGORY_ID = 'PH'
AND ((37.6715 - LATITUDE)*(37.6715 - LATITUDE) + (-77.5465 -
LONGITUDE)*(-77.5465 -LONGITUDE)) * 5329 < 100*100
ORDER BY DIST
Thanks.
Received on Fri Oct 06 2000 - 10:36:26 CDT