X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/7cb27dc881b27602330dd829e4bd0d2130b6b5b1..356724fb8b8d34ba92b5161dec91e7afb18ab99e:/utils/setup.php diff --git a/utils/setup.php b/utils/setup.php index d404f4df..d2d4381e 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -155,8 +155,9 @@ 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'"); } + $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); @@ -481,7 +482,7 @@ $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) "; @@ -495,25 +496,28 @@ $bDidSomething = true; $oDB =& getDB(); - if (!file_exists(CONST_Osmosis_Binary)) fail("please download osmosis"); + if (!file_exists(CONST_Osmosis_Binary)) + { + echo "Please download osmosis.\nIf it is already installed, check the path in your local settings (settings/local.php) file.\n"; + fail("osmosis not found in '".CONST_Osmosis_Binary."'"); + } if (file_exists(CONST_BasePath.'/settings/configuration.txt')) { echo "settings/configuration.txt already exists\n"; } else { - passthru(CONST_Osmosis_Binary.' --read-replication-interval-init '.CONST_BasePath.'/settings'); // update osmosis configuration.txt with our settings - passthru("sed -i 's!baseUrl=.*!baseUrL=".CONST_Replication_Url."!' ".CONST_BasePath.'/settings/configuration.txt'); + passthru("sed -i 's!baseUrl=.*!baseUrl=".CONST_Replication_Url."!' ".CONST_BasePath.'/settings/configuration.txt'); passthru("sed -i 's:maxInterval = .*:maxInterval = ".CONST_Replication_MaxInterval.":' ".CONST_BasePath.'/settings/configuration.txt'); } // Find the last node in the DB - $iLastOSMID = $oDB->getOne("select max(osm_id) as osm_id from place where osm_type = 'N'"); + $iLastOSMID = $oDB->getOne("select max(id) from planet_osm_nodes"); // Lookup the timestamp that node was created (less 3 hours for margin for changsets to be closed) - $sLastNodeURL = 'http://www.openstreetmap.org/api/0.6/node/'.$iLastOSMID; + $sLastNodeURL = 'http://www.openstreetmap.org/api/0.6/node/'.$iLastOSMID."/1"; $sLastNodeXML = file_get_contents($sLastNodeURL); preg_match('#timestamp="(([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z)"#', $sLastNodeXML, $aLastNodeDate); $iLastNodeTimestamp = strtotime($aLastNodeDate[1]) - (3*60*60);