]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/setup.php
disable multithreading in osm2pgsql
[nominatim.git] / utils / setup.php
index ee079a893de647cdb39c42162605b33a40ee49d5..782665d7f61f9fbc096804e44c5a8d19ad7d265c 100755 (executable)
@@ -33,7 +33,6 @@
                array('disable-token-precalc', '', 0, 1, 0, 0, 'bool', 'Disable name precalculation (EXPERT)'),
                array('import-tiger-data', '', 0, 1, 0, 0, 'bool', 'Import tiger data (not included in \'all\')'),
                array('calculate-postcodes', '', 0, 1, 0, 0, 'bool', 'Calculate postcode centroids'),
-               array('create-roads', '', 0, 1, 0, 0, 'bool', ''),
                array('osmosis-init', '', 0, 1, 0, 0, 'bool', 'Generate default osmosis configuration'),
                array('index', '', 0, 1, 0, 0, 'bool', 'Index the data'),
                array('index-noanalyse', '', 0, 1, 0, 0, 'bool', 'Do not perform analyse operations during index (EXPERT)'),
        }
 
        // Assume we can steal all the cache memory in the box (unless told otherwise)
-       $iCacheMemory = (isset($aCMDResult['osm2pgsql-cache'])?$aCMDResult['osm2pgsql-cache']:getCacheMemoryMB());
-       if ($iCacheMemory > getTotalMemoryMB())
+       if (isset($aCMDResult['osm2pgsql-cache']))
+       {
+               $iCacheMemory = $aCMDResult['osm2pgsql-cache'];
+       }
+       else
        {
                $iCacheMemory = getCacheMemoryMB();
-               echo "WARNING: resetting cache memory to $iCacheMemory\n";
        }
 
        $aDSNInfo = DB::parseDSN(CONST_Database_DSN);
                        $osm2pgsql .= ' --tablespace-main-data '.CONST_Tablespace_Place_Data;
                if (CONST_Tablespace_Place_Index)
                        $osm2pgsql .= ' --tablespace-main-index '.CONST_Tablespace_Place_Index;
-               $osm2pgsql .= ' -lsc -O gazetteer --hstore';
+               $osm2pgsql .= ' -lsc -O gazetteer --hstore --number-processes 1';
                $osm2pgsql .= ' -C '.$iCacheMemory;
                $osm2pgsql .= ' -P '.$aDSNInfo['port'];
                $osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file'];
                pgsqlRunScript('ANALYSE');
        }
 
-       if ($aCMDResult['create-roads'])
-       {
-               $bDidSomething = true;
-
-               $oDB =& getDB();
-               $aDBInstances = array();
-               for($i = 0; $i < $iInstances; $i++)
-               {
-                       $aDBInstances[$i] =& getDB(true);
-                       if (!pg_query($aDBInstances[$i]->connection, 'set enable_bitmapscan = off')) fail(pg_last_error($oDB->connection));
-                       $sSQL = 'select count(*) from (select insertLocationRoad(partition, place_id, calculated_country_code, geometry) from ';
-                       $sSQL .= 'placex where osm_id % '.$iInstances.' = '.$i.' and rank_search between 26 and 27 and class = \'highway\') as x ';
-                       if ($aCMDResult['verbose']) echo "$sSQL\n";
-                       if (!pg_send_query($aDBInstances[$i]->connection, $sSQL)) fail(pg_last_error($oDB->connection));
-               }
-               $bAnyBusy = true;
-               while($bAnyBusy)
-               {
-                       $bAnyBusy = false;
-                       for($i = 0; $i < $iInstances; $i++)
-                       {
-                               if (pg_connection_busy($aDBInstances[$i]->connection)) $bAnyBusy = true;
-                       }
-                       sleep(1);
-                       echo '.';
-               }
-               echo "\n";
-       }
-
        if ($aCMDResult['import-tiger-data'])
        {
                $bDidSomething = true;
                        $aDBInstances[$i] =& getDB(true);
                }
 
-               foreach(glob(CONST_BasePath.'/data/tiger2011/*.sql') as $sFile)
+               foreach(glob(CONST_Tiger_Data_Path.'/*.sql') as $sFile)
                {
                        echo $sFile.': ';
                        $hFile = fopen($sFile, "r");
                @symlink(CONST_BasePath.'/website/reverse.php', $sTargetDir.'/reverse.php');
                @symlink(CONST_BasePath.'/website/search.php', $sTargetDir.'/search.php');
                @symlink(CONST_BasePath.'/website/search.php', $sTargetDir.'/index.php');
+               @symlink(CONST_BasePath.'/website/lookup.php', $sTargetDir.'/lookup.php');
                @symlink(CONST_BasePath.'/website/deletable.php', $sTargetDir.'/deletable.php');
                @symlink(CONST_BasePath.'/website/polygons.php', $sTargetDir.'/polygons.php');
                @symlink(CONST_BasePath.'/website/status.php', $sTargetDir.'/status.php');