Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

distance to km javascript

function calcCrow($lat1, $lon1, $lat2, $lon2){
        $R = 6371; // km
        $dLat = toRad($lat2-$lat1);
        $dLon = toRad($lon2-$lon1);
        $lat1 = toRad($lat1);
        $lat2 = toRad($lat2);

        $a = sin($dLat/2) * sin($dLat/2) +sin($dLon/2) * sin($dLon/2) * cos($lat1) * cos($lat2); 
        $c = 2 * atan2(sqrt($a), sqrt(1-$a)); 
        $d = $R * $c;
        return $d;
}

// Converts numeric degrees to radians
function toRad($Value) 
{
    return $Value * pi() / 180;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to read breakline in html 
Javascript :: countdown timer in react js 
Javascript :: js create json array 
Javascript :: format number with commas js 
Javascript :: let in javascript 
Javascript :: foreach javascript arrow function 
Javascript :: express get query parameters 
Javascript :: js var audio = new audio 
Javascript :: jquery hover and hover out 
Javascript :: font google expo 
Javascript :: Terminating timed out worker 
Javascript :: js set canvas size 
Javascript :: javascript get srollwidth 
Javascript :: event delegation in javascript 
Javascript :: JavaScript Use clearInterval() Method 
Javascript :: date add hours javascript 
Javascript :: how hide .html in url 
Javascript :: embed video by javascript 
Javascript :: Set up routes for vue in laravel 
Javascript :: js date yyyy-mm-dd 
Javascript :: reactstrap form post 
Javascript :: view my password jquery 
Javascript :: two sum javascript solution 
Javascript :: Repeat a String Repeat a String 
Javascript :: js get html content 
Javascript :: header logo react native img 
Javascript :: return last two values of array in javascript 
Javascript :: export data to excel using react js 
Javascript :: findbyid mongoose 
Javascript :: remove specific element from array javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =