Skip to content

Commit c218672

Browse files
committed
Added polar-separation test, which checks the optional radius parameter to the haversin function.
1 parent 62e0220 commit c218672

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Check the haversine function returns the correct distance between the North and South poles, using a custom radius.
3+
--SKIPIF--
4+
<?php if (!extension_loaded("geospatial")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
echo haversine(90, 0, -90, 0, 6356.7523);
8+
/*
9+
Test the haversine distance between the North and South poles.
10+
11+
Accept defined (equatorial) Earth Radius in km (which is based on WGS-84):
12+
- 6,378,1370m (at the equator).
13+
- 6,356,7523m (at the equator).
14+
*/
15+
?>
16+
--EXPECT--
17+
19970.32632637

0 commit comments

Comments
 (0)