Skip to content

Instantly share code, notes, and snippets.

@aditagusta
Created January 25, 2022 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aditagusta/e5e76814ed090a03287bd86f9d7e257d to your computer and use it in GitHub Desktop.
Save aditagusta/e5e76814ed090a03287bd86f9d7e257d to your computer and use it in GitHub Desktop.
Menghitung Jarak Antara 1 Titik Dengan Titik Lainnya
// Lokasi Awal
$my_latitude = $request->get('latitude');
$my_longitude = $request->get('longitude');
// Lokasi Tujuan
$my_latitude = $request->get('latitude');
$my_longitude = $request->get('longitude');
$distance = round((((acos(sin(($my_latitude*pi()/180)) * sin(($toko_latitude*pi()/180))+cos(($my_latitude*pi()/180)) * cos(($toko_latitude*pi()/180)) * cos((($my_longitude- $toko_longitude)*pi()/180))))*180/pi())*60*1.1515*1.609344), 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment