tags:

views:

66

answers:

1

Trying to work out distance between two points (lat & lng)
I have an issue because PHP is (after running through my distance function) returning the same distance regardless.

I break it down and I find that PHP has an issue with some maths

For this example, assume: Lat2: 49.263205

So, I want to convert lat2 to a radian

$pi = pi();
$radianlat2 = $lat2 * ( $pi / 180);

and PHP is failing, it's giving me the same number everytime, regardless of the lat I feed it.

If I break it down I can explain:

$pi / 180 = 0.017453292519943

49.263205 * 0.017453292519943 = 0.859805127334919

BUT if you echo $radianlat2 above you get: 0.85521133347722

Did I just break PHP or am I loosing the plot?

+1  A: 

Try the solutions that were offered to me when I had a similar problem.

Victor Stanciu
wow - I so wish I could go back to school and yell at younger me "pay attention - you are going to need this stuff later!!" ... hmmm reading up now thnx
keranm
well? did it work?
Victor Stanciu