Oracle spatial search within distance
- by KA_lin
I have the following table Cities:
ID(int),City(char),latitude(float),longitude(float).
Now based on a user`s longitude(ex:44.8) and latitude(ex:46.3) I want to search for all the cities near him within 100 miles/KM.
I have found some examples but don`t know how to adapt them to my case
select *
from GEO.Cities a
where SDO_WITHIN_DISTANCE([I don`t know],
MDSYS.SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(44.8,46.3, NULL) ,NULL, NULL),
'distance = 1000') = 'TRUE';
Any help would be appreciated.
P.S: If it is possible to have the distance and to be sorted
P.P.S: I want to do it in this way due to performance issues, I have done this in this way http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL but it takes too long...