MySQL Forums
Forum List  »  GIS

Re: WGS84 Data & distance queries
Posted by: sud pan
Date: April 18, 2007 01:07AM

I am using this query to calculate nearest street from a given lat/long (-37.8954, 145.0616). I have lat/ lon of streets stored in colunm lat and lon. The distance is resulted in Kilometer. I have more that 330,000 records in table and the performace is quite good,less than a second.

SELECT street, (acos(sin(radians(-37.8954)) * sin(radians(Lat))
+ cos(radians(-37.8954)) * cos(radians(Lat)) * cos(radians(145.0616 -
))*6371 as dist FROM roads order by dist asc limit 5

Options: ReplyQuote

Written By
April 25, 2006 07:26PM
December 19, 2006 03:42AM
Re: WGS84 Data & distance queries
April 18, 2007 01:07AM
September 01, 2007 02:33PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.