Ok, Thanks Andrew for your help. I see the mistake is in precision
values.

Srikanth

On Jan 25, 4:37 pm, Andrew Leach <[email protected]>
wrote:
> On Jan 25, 10:57 am, srikanth <[email protected]> wrote:
>
>
>
> > Data is provided fromhttp://220.225.231.147/gmaps/testing.asp
> > using SQL Query
>
> The first result contains
> lat="37.386339" lng="-122.085823" distance="2627.24169360985"
> which is obviously incorrect. If that is generated by this query...
>
> > select top 10 * from (SELECT *, ( 3959 * acos( cos( radians(37) ) *
> > cos
> > ( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin
> > ( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM maps ) as
> > results where distance < 10000
>
> ...then it's obviously calculating the distance incorrectly.
>
> Your formula is correct as the spherical law of cosines, so I guess
> that it's calculating the distance correctly and the points you are
> measuring are wrong. You do get the results you're getting if your
> "lat" variable is zero and you measure the distance from the equator.
> Perhaps that will give you something to look at.
>
> As an aside, you are introducing extra spaces into your XML when you
> encode the special characters, but that's not related to distance
> calculations.
>
> Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to