mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-09 19:44:07 +00:00
default path fixes
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
if (!$sUserError) $sUserError = $sError;
|
if (!$sUserError) $sUserError = $sError;
|
||||||
log('ERROR:'.$sError);
|
log('ERROR:'.$sError);
|
||||||
echo $sUserError;
|
echo $sUserError."\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#define PG_OID_INT8 20
|
#define PG_OID_INT8 20
|
||||||
#define PG_OID_INT4 23
|
#define PG_OID_INT4 23
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
#define PGint16(x) (x)
|
#define PGint16(x) (x)
|
||||||
#define PGint32(x) (x)
|
#define PGint32(x) (x)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once('../lib/init-cmd.php');
|
require_once(dirname(dirname(__FILE__)).'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
@@ -10,14 +10,36 @@
|
|||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
||||||
array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
|
array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
|
||||||
|
|
||||||
|
array('create-db', '', 0, 1, 0, 0, 'bool', 'Build a blank nominatim db'),
|
||||||
|
array('load-data', '', 0, 1, 0, 0, 'realpath', 'Import a osm file'),
|
||||||
array('create-partitions', '', 0, 1, 0, 0, 'bool', 'Create required partition tables and triggers'),
|
array('create-partitions', '', 0, 1, 0, 0, 'bool', 'Create required partition tables and triggers'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
|
if ($aCMDResult['create-db'])
|
||||||
|
{
|
||||||
|
// TODO: path detection, detection memory, etc.
|
||||||
|
passthru('createdb nominatim');
|
||||||
|
passthru('createlang plpgsql nominatim');
|
||||||
|
passthru('psql -f /mqdata/mapquest/postgres-9.0.1-server/share/contrib/_int.sql nominatim');
|
||||||
|
passthru('psql -f /mqdata/mapquest/postgres-9.0.1-server/share/contrib/hstore.sql nominatim');
|
||||||
|
passthru('psql -f /mqdata/mapquest/postgres-9.0.1-server/share/contrib/postgis-1.5/postgis.sql nominatim');
|
||||||
|
passthru('psql -f /mqdata/mapquest/postgres-9.0.1-server/share/contrib/postgis-1.5/spatial_ref_sys.sql nominatim');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($aCMDResult['load-data'])
|
||||||
|
{
|
||||||
|
passthru(CONST_BasePath.'/osm2pgsql -lsc -O gazetteer -C 10000 --hstore -d nominatim '.$aCMDResult['load-data']);
|
||||||
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-partitions'])
|
if ($aCMDResult['create-partitions'])
|
||||||
{
|
{
|
||||||
$sSQL = 'select distinct country_code from country_name order by country_code';
|
$sSQL = 'select distinct country_code from country_name order by country_code';
|
||||||
$aPartitions = $oDB->getCol($sSQL);
|
$aPartitions = $oDB->getCol($sSQL);
|
||||||
|
if (PEAR::isError($aPartitions))
|
||||||
|
{
|
||||||
|
fail($aPartitions->getMessage());
|
||||||
|
}
|
||||||
$aPartitions[] = 'none';
|
$aPartitions[] = 'none';
|
||||||
|
|
||||||
$sTemplate = file_get_contents(CONST_BasePath.'/sql/partitions.src.sql');
|
$sTemplate = file_get_contents(CONST_BasePath.'/sql/partitions.src.sql');
|
||||||
@@ -32,6 +54,7 @@
|
|||||||
$sTemplate = str_replace($aMatch[0], $sResult, $sTemplate);
|
$sTemplate = str_replace($aMatch[0], $sResult, $sTemplate);
|
||||||
}
|
}
|
||||||
echo $sTemplate;
|
echo $sTemplate;
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
showUsage($aCMDOptions, true);
|
showUsage($aCMDOptions, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user