]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/lib.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib / lib.php
index b5c4df133b9e79cda4fa8f33b4cf93516132865d..fa71d296277ef35a71f047c94673f870f8f34d86 100644 (file)
@@ -14,7 +14,7 @@ function getProcessorCount()
 {
     $sCPU = file_get_contents('/proc/cpuinfo');
     preg_match_all('#processor\s+: [0-9]+#', $sCPU, $aMatches);
-    return sizeof($aMatches[0]);
+    return count($aMatches[0]);
 }
 
 
@@ -530,11 +530,12 @@ function parseLatLon($sQuery)
         $sFound    = $aData[0];
         $fQueryLat = ($aData[1]=='N'?1:-1) * ($aData[2] + $aData[3]/60 + $aData[4]/3600);
         $fQueryLon = ($aData[5]=='E'?1:-1) * ($aData[6] + $aData[7]/60 + $aData[8]/3600);
-    } elseif (preg_match('/\\s*([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+)[″" ]+([NS])[, ]+([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+)[″" ]+([EW])\\s*/', $sQuery, $aData)) {
-        /*                     1            2              3             4          5            6              7             8
+    } elseif (preg_match('/\\s*([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+[0-9.]*)[″" ]+([NS])[, ]+([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+[0-9.]*)[″" ]+([EW])\\s*/', $sQuery, $aData)) {
+        /*                     1            2              3                    4          5            6              7                     8
          * degrees decimal seconds
          * 40 26 46 N 79 58 56 W
          * 40° 26′ 46″ N, 79° 58′ 56″ W
+         * 40° 26′ 46.78″ N, 79° 58′ 56.89″ W
          */
         $sFound    = $aData[0];
         $fQueryLat = ($aData[4]=='N'?1:-1) * ($aData[1] + $aData[2]/60 + $aData[3]/3600);
@@ -584,10 +585,10 @@ function geometryText2Points($geometry_as_text, $fRadius)
         //
         preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/', $aMatch[1], $aPolyPoints, PREG_SET_ORDER);
         //
-    } elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch)) {
+/*    } elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch)) {
         //
         preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/', $aMatch[1], $aPolyPoints, PREG_SET_ORDER);
-        //
+        */
     } elseif (preg_match('#POINT\\((-?[0-9.]+) (-?[0-9.]+)\\)#', $geometry_as_text, $aMatch)) {
         //
         $aPolyPoints = createPointsAroundCenter($aMatch[1], $aMatch[2], $fRadius);