-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazimuth-sample.php
28 lines (24 loc) · 1.3 KB
/
azimuth-sample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
# --------------------------------------------------------------------------------------------
# __ /\ \__/\ \
# __ ____ /\_\ ___ ___ __ __\ \ ,_\ \ \___
# /'__`\ /\_ ,`\\/\ \ /' __` __`\/\ \/\ \\ \ \/\ \ _ `\
# /\ \L\.\_\/_/ /_\ \ \/\ \/\ \/\ \ \ \_\ \\ \ \_\ \ \ \ \
# \ \__/.\_\ /\____\\ \_\ \_\ \_\ \_\ \____/ \ \__\\ \_\ \_\
# \/__/\/_/ \/____/ \/_/\/_/\/_/\/_/\/___/ \/__/ \/_/\/_/
#
# Azimuth : Simple PHP library to compute azimuth (°), distance (km) & sight altitude (°)
# GNU GPL v3
# Gautier Michelin, 2015
# based on Don Cross work, http://cosinekitty.com/compass.html
#
# Usage example
#
# -------------------------------------------------------------------------------------------
require_once('lib/azimuth.php');
$tour_eiffel = array("lat"=> 48.85825, "lon"=>2.2945, "elv"=>357.5);
$le_mans = array("lat"=> 48.006110000000010000, "lon"=>0.199556000000029600, "elv"=>134);
// Le Mans is 181.149 km from Paris, Paris is at NW from Le Mans (58°), altitude is -1 so you should look
// just under the horizon from the Tour Eiffel to have a look at Le Mans, but guess what, it's a bit far...
$result = Calculate($le_mans, $tour_eiffel);
print_r($result);