php add km to longitude

Solutions on MaxInterview for php add km to longitude by the best coders in the world

showing results for - "php add km to longitude"
Beth
10 Oct 2019
1<?php
2$distance = 100;
3$earthRadius = 6371;
4$lat1 = -26.4853239150483;
5$lon1 = -49.075927734375;
6$bearing = 0;
7
8$lat2 = asin(sin($lat1) * cos($distance / $earthRadius) + cos($lat1) * sin($distance / $earthRadius) * cos($bearing));
9$lon2 = $lon1 + atan2(sin($bearing) * sin($distance / $earthRadius) * cos($lat1), cos($distance / $earthRadius) - sin($lat1) * sin($lat2));
10
11echo 'LAT: ' . $lat2 . '<br >';
12echo 'LNG: ' . $lon2;
13?>
14