Skip to content

Commit 51e609c

Browse files
author
Nathaniel McHugh
committed
* fix spacing in copyright notice
* add test for decimal minutes * add test on prime meridian based on this photo http://upload.wikimedia.org/wikipedia/commons/a/a1/Garmin_GPS_at_Greenwich_Observatory.jpg
1 parent 9d42be2 commit 51e609c

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed

geospatial.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
/*
22
+----------------------------------------------------------------------+
3-
| PHP Version 5 |
3+
| PHP Version 5 |
44
+----------------------------------------------------------------------+
5-
| Copyright (c) 1997-2012 The PHP Group |
5+
| Copyright (c) 1997-2012 The PHP Group |
66
+----------------------------------------------------------------------+
7-
| This source file is subject to version 3.01 of the PHP license, |
8-
| that is bundled with this package in the file LICENSE, and is |
9-
| available through the world-wide-web at the following url: |
10-
| http://www.php.net/license/3_01.txt |
7+
| This source file is subject to version 3.01 of the PHP license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available through the world-wide-web at the following url: |
10+
| http://www.php.net/license/3_01.txt |
1111
| If you did not receive a copy of the PHP license and are unable to |
12-
| obtain it through the world-wide-web, please send a note to |
13-
| [email protected] so we can mail you a copy immediately. |
12+
| obtain it through the world-wide-web, please send a note to |
13+
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Author: |
15+
| Author: |
1616
+----------------------------------------------------------------------+
1717
*/
1818

19+
1920
/* $Id$ */
2021

2122
#ifdef HAVE_CONFIG_H

tests/Greenwich.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
WGS84 to OSGB36 for Grennwich Observertory
3+
--FILE--
4+
<?php
5+
6+
$lat = dms_to_decimal(51, 28.675, 0, 'N');
7+
$long = dms_to_decimal(0, 0.089, 0, 'W');
8+
9+
$polar = transform_datum($lat, $long, GEO_WGS84, GEO_AIRY_1830);
10+
11+
$airyLong = $polar['long'];
12+
$wgs84Long = $long;
13+
14+
$diferenceWGS84 = haversine($lat, $long, $lat, 0);
15+
$diferenceAiry = haversine($polar['lat'], $polar['long'], $polar['lat'], 0);
16+
//lat long of merdian in Airy 1830 ideally long of 0
17+
var_dump($polar);
18+
//distance in m of difference from lat long and meridian
19+
var_dump($diferenceWGS84 * 1000, $diferenceAiry * 1000);
20+
--EXPECT--
21+
array(3) {
22+
["lat"]=>
23+
float(51.477400823311)
24+
["long"]=>
25+
float(0.00013627354767069)
26+
["height"]=>
27+
float(-21.205192557536)
28+
}
29+
float(102.84185171429)
30+
float(9.4481679649233)

tests/dms_to_decimal.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ $decimal = dms_to_decimal(2, 18, 25.7, 'W');
99
var_dump($decimal);
1010
$decimal = dms_to_decimal(-2, 18, 25.7, 'W');
1111
var_dump($decimal);
12+
$decimal = dms_to_decimal(-2, 18.42833333333333333333, 0, 'W');
13+
var_dump($decimal);
14+
1215

1316
--EXPECT--
1417
float(-1.0342916666667)
1518
float(-2.3071388888889)
19+
float(-2.3071388888889)
1620
float(-2.3071388888889)

0 commit comments

Comments
 (0)