$sFound = $aData[0];
$fQueryLat = ($aData[2]=='N'?1:-1) * ($aData[1]);
$fQueryLon = ($aData[4]=='E'?1:-1) * ($aData[3]);
- } elseif (preg_match('/(\\[|^|\\b)(-?[0-9]+[0-9]*\\.[0-9]+)[, ]+(-?[0-9]+[0-9]*\\.[0-9]+)(\\]|$|\\b)/', $sQuery, $aData)) {
- /* 1 2 3 4
+ } elseif (preg_match('/(\\[|^|\\b)?(-?[0-9]+[0-9]*\\.[0-9]+)[, ]+(-?[0-9]+[0-9]*\\.[0-9]+)(\\]|$|\\b)/', $sQuery, $aData)) {
+ /* 1 2 3 4
* degrees decimal
* 12.34, 56.78
* [12.456,-78.90]
$this->assertEquals($aRes['pt']->radius(), 0.1);
$this->assertEquals($aRes['query'], '');
+ $aRes = NearPoint::extractFromQuery(' -12.456,-78.90 ');
+ $this->assertEquals($aRes['pt']->lat(), -12.456);
+ $this->assertEquals($aRes['pt']->lon(), -78.90);
+
// http://en.wikipedia.org/wiki/Geographic_coordinate_conversion
// these all represent the same location
$aQueries = array(