]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 20 May 2013 08:51:24 +0000 (10:51 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 20 May 2013 08:51:24 +0000 (10:51 +0200)
Conflicts:
utils/setup.php
utils/update.php

1  2 
settings/settings.php
utils/setup.php
utils/update.php

diff --combined settings/settings.php
index cdc28a3f3f0a13adbdde6826ed50631609ececcb,fc6ee8dedfca2f4fa7f46ad7246121e5e8c4518e..4e9d71f031742d17bd530d8282c6313524a7d5fc
@@@ -17,6 -17,9 +17,9 @@@
        @define('CONST_Osm2pgsql_Binary', CONST_BasePath.'/osm2pgsql/osm2pgsql');
        @define('CONST_Osmosis_Binary', '/usr/bin/osmosis');
  
+       // osm2pgsql settings
+       @define('CONST_Osm2pgsql_Flatnode_File', null);
        // Replication settings
        @define('CONST_Replication_Url', 'http://planet.openstreetmap.org/replication/minute');
        @define('CONST_Replication_MaxInterval', '3600');
  
        // Website settings
        @define('CONST_NoAccessControl', true);
 -      @define('CONST_ClosedForIndexing', false);
 -      @define('CONST_ClosedForIndexingExceptionIPs', '');
        @define('CONST_BlockedIPs', '');
 +      @define('CONST_IPBanFile', CONST_BasePath.'/settings/ip_blocks');
 +      @define('CONST_WhitelistedIPs', '');
 +      @define('CONST_BlockedUserAgents', '');
 +      @define('CONST_BlockReverseMaxLoad', 15);
        @define('CONST_BulkUserIPs', '');
  
 -      @define('CONST_Website_BaseURL', 'http://'.php_uname('n').'/');
 +      @define('CONST_Website_BaseURL', 'http://nominatim.openstreetmap.org/');
        @define('CONST_Tile_Default', 'Mapnik');
  
        @define('CONST_Default_Language', false);
diff --combined utils/setup.php
index 6b0a5b37504bb94a1f5b1613996bdc2aeb5e12e6,081efd0de477d6fce0ddc0b145a522d2b5c814aa..80c139f761f6d749cba900445e820aebfb7e1353
                        echo "Please download and build osm2pgsql.\nIf it is already installed, check the path in your local settings (settings/local.php) file.\n";
                        fail("osm2pgsql not found in '$osm2pgsql'");
                }
+               if (!is_null(CONST_Osm2pgsql_Flatnode_File))
+               {
+                       $osm2pgsql .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
+               }
 +              $osm2pgsql .= ' --tablespace-slim-index ssd --tablespace-main-index ssd --tablespace-main-data ssd --tablespace-slim-data data';
                $osm2pgsql .= ' -lsc -O gazetteer --hstore';
 -              $osm2pgsql .= ' -C '.$iCacheMemory;
 +              $osm2pgsql .= ' -C 16000';
                $osm2pgsql .= ' -P '.$aDSNInfo['port'];
                $osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file'];
                passthruCheckReturn($osm2pgsql);
                $sSQL .= "select 'P',nextval('seq_postcodes'),'place','postcode',postcode,calculated_country_code,";
                $sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from (select calculated_country_code,postcode,";
                $sSQL .= "avg(st_x(st_centroid(geometry))) as x,avg(st_y(st_centroid(geometry))) as y ";
 -              $sSQL .= "from placex where postcode is not null group by calculated_country_code,postcode) as x";
 +              $sSQL .= "from placex where postcode is not null and calculated_country_code not in ('ie') group by calculated_country_code,postcode) as x";
                if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
  
                $sSQL = "insert into placex (osm_type,osm_id,class,type,postcode,calculated_country_code,geometry) ";
diff --combined utils/update.php
index e8972f1d26f4d3cefa962667459966d38f548050,d38de598433d665b14a14217151d55dadea83a16..f82696c215c6217d17237d05383158433c91bdd4
@@@ -46,6 -46,7 +46,6 @@@
                showUsage($aCMDOptions, true, 'Select either import of hourly or daily');
        }
  
 -      if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
        if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;
  /*
        // Lock to prevent multiple copies running
                {
                        // Import the file
                        $sCMD = CONST_Osm2pgsql_Binary.' -klas -C 2000 -O gazetteer -d '.$aDSNInfo['database'].' '.$sNextFile;
+                       if (!is_null(CONST_Osm2pgsql_Flatnode_File))
+                       {
+                               $sCMD .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
+                       }
                        echo $sCMD."\n";
                        exec($sCMD, $sJunk, $iErrorLevel);
  
  
                // import generated change file
                $sCMD = CONST_Osm2pgsql_Binary.' -klas -C 2000 -O gazetteer -d '.$aDSNInfo['database'].' '.$sTemporaryFile;
+               if (!is_null(CONST_Osm2pgsql_Flatnode_File))
+               {
+                       $sCMD .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
+               }
                echo $sCMD."\n";
                exec($sCMD, $sJunk, $iErrorLevel);
                if ($iErrorLevel)
  
        if ($aResult['index'])
        {
 +              if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
                passthru(CONST_BasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$aResult['index-instances'].' -r '.$aResult['index-rank']);
        }
  
                $sCMDDownload = $sOsmosisCMD.' --read-replication-interval workingDirectory='.$sOsmosisConfigDirectory.' --simplify-change --write-xml-change '.$sImportFile;
                $sCMDCheckReplicationLag = $sOsmosisCMD.' -q --read-replication-lag workingDirectory='.$sOsmosisConfigDirectory;
                $sCMDImport = CONST_Osm2pgsql_Binary.' -klas -C 2000 -O gazetteer -d '.$aDSNInfo['database'].' '.$sImportFile;
 -              $sCMDIndex = $sBasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$aResult['index-instances'];
+               if (!is_null(CONST_Osm2pgsql_Flatnode_File))
+               {
+                       $sCMDImport .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
+               }
 +              $sCMDIndex = $sBasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'];
                if (!$aResult['no-npi']) {
                        $sCMDIndex .= '-F ';
                }
                        $sBatchEnd = getosmosistimestamp($sOsmosisConfigDirectory);
  
                        // Index file
 -                      $sThisIndexCmd = $sCMDIndex;
 +                      if (!isset($aResult['index-instances']))
 +                      {
 +                              if (getLoadAverage() < 15)
 +                                      $iIndexInstances = 2;
 +                              else
 +                                      $iIndexInstances = 1;
 +                      } else
 +                              $iIndexInstances = $aResult['index-instances'];
 +
 +                      $sThisIndexCmd = $sCMDIndex.' -t '.$iIndexInstances;
  
                        if (!$aResult['no-npi'])
                        {