MySQL Forums
Forum List  »  GIS

Re: What returns from distance function?
Posted by: Bjorn Brala
Date: May 07, 2010 01:35AM

I've seen a colleage use the following formula to get distance from the database,

( 6371 * acos( cos( radians(".$fLat.") ) * cos( radians( X(v.geo) ) ) * cos( radians( Y(v.geo) ) - radians(".$fLng.") ) + sin( radians(".$fLat.") ) * sin( radians( X(v.geo) ) ) ) ) AS distance

This results in a distance in KM, geo is a geometry field, fLat/fLng are well, lat and long ;)

Anyways, that might help you find you find out if the distance function related to meters or not.

Options: ReplyQuote

Written By
April 18, 2010 06:01AM
April 18, 2010 11:13AM
Re: What returns from distance function?
May 07, 2010 01:35AM

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.