[ create a new paste ] login | about

Link: http://codepad.org/gKIEp635    [ raw code | output | fork ]

PHP, pasted on Dec 30:
1
2
3
4
5
6
7
8
9
10
11
<?php

$lat1 = 59.389057; $lng1 = 17.937422;
$lat2 = 59.388914; $lng2 = 17.920441;

$latD = (691 / 6) * ($lat2 - $lat1);
$lngD = (691 / 6) * ($lng2 - $lng1) * cos($lat2 / 57.3);

$distance = sqrt( $latD * $latD + $lngD * $lngD );

echo "$distance\n";


Output:
1
0.99609471346015


Create a new paste based on this one


Comments: