Oracle spatial search within distance
Posted
by
KA_lin
on Stack Overflow
See other posts from Stack Overflow
or by KA_lin
Published on 2012-01-30T09:31:19Z
Indexed on
2012/10/08
9:37 UTC
Read the original article
Hit count: 187
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...
© Stack Overflow or respective owner