]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #905 from mtmail/illinois-li-case-insensitive
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 10 Feb 2018 14:50:42 +0000 (15:50 +0100)
committerGitHub <noreply@github.com>
Sat, 10 Feb 2018 14:50:42 +0000 (15:50 +0100)
make sure Illinois,Alabama,Louisiana state code special handling is case insensitive

lib/Geocode.php
lib/lib.php
test/php/Nominatim/NominatimTest.php
utils/update.php

index b2eee7ba6b927162e6466c8045c23d85b2ca0b12..d5647c761edbc90a7a575edf17227eb8789f1710 100644 (file)
@@ -225,14 +225,14 @@ class Geocode
         $aViewbox = $oParams->getStringList('viewboxlbrt');
         if ($aViewbox) {
             if (count($aViewbox) != 4) {
-                userError("Bad parmater 'viewboxlbrt'. Expected 4 coordinates.");
+                userError("Bad parameter 'viewboxlbrt'. Expected 4 coordinates.");
             }
             $this->setViewbox($aViewbox);
         } else {
             $aViewbox = $oParams->getStringList('viewbox');
             if ($aViewbox) {
                 if (count($aViewbox) != 4) {
-                    userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
+                    userError("Bad parameter 'viewbox'. Expected 4 coordinates.");
                 }
                 $this->setViewBox($aViewbox);
             } else {
index b5c4df133b9e79cda4fa8f33b4cf93516132865d..e283e8369ee7dbe19ddf5b984f496964da0adb64 100644 (file)
@@ -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);
index 60770208a9d21277c61f80230031a27109999bc1..ed738c3773046a1739b138273131ad67c3ac76c3 100644 (file)
@@ -171,6 +171,8 @@ class NominatimTest extends \PHPUnit_Framework_TestCase
  
                      '40 26 46 N 79 58 56 W',
                      '40° 26′ 46″ N 79° 58′ 56″ W',
+                     '40° 26′ 46.00″ N 79° 58′ 56.00″ W',
+                     '40°26′46″N 79°58′56″W',
                      'N 40 26 46 W 79 58 56',
                      'N 40° 26′ 46″, W 79° 58′ 56″',
                      'N 40° 26\' 46", W 79° 58\' 56"',
index d34010c78eb3f9ab2faddbfef2a5a7ba42577359..d643e4bca72f7106ac845fed1a366113c38e89e1 100755 (executable)
@@ -263,7 +263,8 @@ if ($aResult['index']) {
 if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
     //
     if (strpos(CONST_Replication_Url, 'download.geofabrik.de') !== false && CONST_Replication_Update_Interval < 86400) {
-        fail("Error: Update interval too low for download.geofabrik.de.  Please check install documentation (http://nominatim.org/release-docs/latest/Import-and-Update#setting-up-the-update-process)\n");
+        fail('Error: Update interval too low for download.geofabrik.de. ' .
+             "Please check install documentation (http://nominatim.org/release-docs/latest/Import-and-Update#setting-up-the-update-process)\n");
     }
 
     $sImportFile = CONST_InstallPath.'/osmosischange.osc';