Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php add km to longitude

<?php
$distance = 100;
$earthRadius = 6371;
$lat1 = -26.4853239150483;
$lon1 = -49.075927734375;
$bearing = 0;

$lat2 = asin(sin($lat1) * cos($distance / $earthRadius) + cos($lat1) * sin($distance / $earthRadius) * cos($bearing));
$lon2 = $lon1 + atan2(sin($bearing) * sin($distance / $earthRadius) * cos($lat1), cos($distance / $earthRadius) - sin($lat1) * sin($lat2));

echo 'LAT: ' . $lat2 . '<br >';
echo 'LNG: ' . $lon2;
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #add #km #longitude
ADD COMMENT
Topic
Name
5+4 =