forked from ideesculture/azimuth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azimuth-sample.php
28 lines (24 loc) · 1.26 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');
$me = array("lat"=> 52.509915, "lon"=>13.506030, "elv"=>41);
$plane = array("lat"=> 52.4772, "lon"=>13.4841, "elv"=>37000 * 0.3048);
// 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($plane, $me);
print_r($result);