forked from hans/Nominatim
tabs-to-spaces
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
||||||
|
|
||||||
class Geocode
|
class Geocode
|
||||||
{
|
{
|
||||||
protected $oDB;
|
protected $oDB;
|
||||||
|
|
||||||
protected $aLangPrefOrder = array();
|
protected $aLangPrefOrder = array();
|
||||||
@@ -1837,5 +1837,5 @@
|
|||||||
} // end lookup()
|
} // end lookup()
|
||||||
|
|
||||||
|
|
||||||
} // end class
|
} // end class
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class PlaceLookup
|
|
||||||
{
|
class PlaceLookup
|
||||||
|
{
|
||||||
protected $oDB;
|
protected $oDB;
|
||||||
|
|
||||||
protected $aLangPrefOrder = array();
|
protected $aLangPrefOrder = array();
|
||||||
@@ -357,5 +358,4 @@
|
|||||||
}
|
}
|
||||||
return $aOutlineResult;
|
return $aOutlineResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class ReverseGeocode
|
|
||||||
{
|
class ReverseGeocode
|
||||||
|
{
|
||||||
protected $oDB;
|
protected $oDB;
|
||||||
protected $iMaxRank = 28;
|
protected $iMaxRank = 28;
|
||||||
|
|
||||||
@@ -209,5 +210,4 @@
|
|||||||
'fraction' => ($bPlaceIsTiger || $bPlaceIsLine) ? $fFraction : -1);
|
'fraction' => ($bPlaceIsTiger || $bPlaceIsLine) ? $fFraction : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
18
lib/cmd.php
18
lib/cmd.php
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getCmdOpt($aArg, $aSpec, &$aResult, $bExitOnError = false, $bExitOnUnknown = false)
|
function getCmdOpt($aArg, $aSpec, &$aResult, $bExitOnError = false, $bExitOnUnknown = false)
|
||||||
{
|
{
|
||||||
$aQuick = array();
|
$aQuick = array();
|
||||||
$aCounts = array();
|
$aCounts = array();
|
||||||
|
|
||||||
@@ -108,10 +108,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $bUnknown;
|
return $bUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUsage($aSpec, $bExit = false, $sError = false)
|
function showUsage($aSpec, $bExit = false, $sError = false)
|
||||||
{
|
{
|
||||||
if ($sError)
|
if ($sError)
|
||||||
{
|
{
|
||||||
echo basename($_SERVER['argv'][0]).': '.$sError."\n";
|
echo basename($_SERVER['argv'][0]).': '.$sError."\n";
|
||||||
@@ -142,14 +142,14 @@
|
|||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function chksql($oSql, $sMsg = false)
|
function chksql($oSql, $sMsg = false)
|
||||||
{
|
{
|
||||||
if (PEAR::isError($oSql))
|
if (PEAR::isError($oSql))
|
||||||
{
|
{
|
||||||
fail($sMsg || $oSql->getMessage(), $oSql->userinfo);
|
fail($sMsg || $oSql->getMessage(), $oSql->userinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oSql;
|
return $oSql;
|
||||||
}
|
}
|
||||||
|
|||||||
27
lib/db.php
27
lib/db.php
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('DB.php');
|
|
||||||
|
|
||||||
function &getDB($bNew = false, $bPersistent = false)
|
require_once('DB.php');
|
||||||
{
|
|
||||||
|
function &getDB($bNew = false, $bPersistent = false)
|
||||||
|
{
|
||||||
// Get the database object
|
// Get the database object
|
||||||
$oDB = chksql(DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent),
|
$oDB = chksql(DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent),
|
||||||
"Failed to establish database connection");
|
"Failed to establish database connection");
|
||||||
@@ -12,23 +13,23 @@
|
|||||||
$iMaxExecution = ini_get('max_execution_time') * 1000;
|
$iMaxExecution = ini_get('max_execution_time') * 1000;
|
||||||
if ($iMaxExecution > 0) $oDB->query("SET statement_timeout TO $iMaxExecution");
|
if ($iMaxExecution > 0) $oDB->query("SET statement_timeout TO $iMaxExecution");
|
||||||
return $oDB;
|
return $oDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDBQuoted($s)
|
function getDBQuoted($s)
|
||||||
{
|
{
|
||||||
return "'".pg_escape_string($s)."'";
|
return "'".pg_escape_string($s)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPostgresVersion(&$oDB)
|
function getPostgresVersion(&$oDB)
|
||||||
{
|
{
|
||||||
$sVersionString = $oDB->getOne('select version()');
|
$sVersionString = $oDB->getOne('select version()');
|
||||||
preg_match('#PostgreSQL ([0-9]+)[.]([0-9]+)[^0-9]#', $sVersionString, $aMatches);
|
preg_match('#PostgreSQL ([0-9]+)[.]([0-9]+)[^0-9]#', $sVersionString, $aMatches);
|
||||||
return (float) ($aMatches[1].'.'.$aMatches[2]);
|
return (float) ($aMatches[1].'.'.$aMatches[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPostgisVersion(&$oDB)
|
function getPostgisVersion(&$oDB)
|
||||||
{
|
{
|
||||||
$sVersionString = $oDB->getOne('select postgis_full_version()');
|
$sVersionString = $oDB->getOne('select postgis_full_version()');
|
||||||
preg_match('#POSTGIS="([0-9]+)[.]([0-9]+)[.]([0-9]+)( r([0-9]+))?"#', $sVersionString, $aMatches);
|
preg_match('#POSTGIS="([0-9]+)[.]([0-9]+)[.]([0-9]+)( r([0-9]+))?"#', $sVersionString, $aMatches);
|
||||||
return (float) ($aMatches[1].'.'.$aMatches[2]);
|
return (float) ($aMatches[1].'.'.$aMatches[2]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('init.php');
|
|
||||||
require_once('cmd.php');
|
|
||||||
|
|
||||||
// handle http proxy when using file_get_contents
|
require_once('init.php');
|
||||||
if (CONST_HTTP_Proxy) {
|
require_once('cmd.php');
|
||||||
|
|
||||||
|
// handle http proxy when using file_get_contents
|
||||||
|
if (CONST_HTTP_Proxy) {
|
||||||
$proxy = 'tcp://' . CONST_HTTP_Proxy_Host . ':' . CONST_HTTP_Proxy_Port;
|
$proxy = 'tcp://' . CONST_HTTP_Proxy_Host . ':' . CONST_HTTP_Proxy_Port;
|
||||||
$aHeaders = array();
|
$aHeaders = array();
|
||||||
if(CONST_HTTP_Proxy_Login != null && CONST_HTTP_Proxy_Login != '' && CONST_HTTP_Proxy_Password != null && CONST_HTTP_Proxy_Password != '') {
|
if(CONST_HTTP_Proxy_Login != null && CONST_HTTP_Proxy_Login != '' && CONST_HTTP_Proxy_Password != null && CONST_HTTP_Proxy_Password != '') {
|
||||||
@@ -23,4 +24,4 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
stream_context_set_default($aContext);
|
stream_context_set_default($aContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('init.php');
|
|
||||||
require_once('ParameterParser.php');
|
require_once('init.php');
|
||||||
|
require_once('ParameterParser.php');
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
*
|
*
|
||||||
* Error handling functions
|
* Error handling functions
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function chksql($oSql, $sMsg = "Database request failed")
|
|
||||||
{
|
function chksql($oSql, $sMsg = "Database request failed")
|
||||||
|
{
|
||||||
if (!PEAR::isError($oSql)) return $oSql;
|
if (!PEAR::isError($oSql)) return $oSql;
|
||||||
|
|
||||||
header('HTTP/1.0 500 Internal Server Error');
|
header('HTTP/1.0 500 Internal Server Error');
|
||||||
@@ -17,7 +19,7 @@
|
|||||||
$sSqlError = $oSql->getMessage();
|
$sSqlError = $oSql->getMessage();
|
||||||
|
|
||||||
echo <<<INTERNALFAIL
|
echo <<<INTERNALFAIL
|
||||||
<html>
|
<html>
|
||||||
<head><title>Internal Server Error</title></head>
|
<head><title>Internal Server Error</title></head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Internal Server Error</h1>
|
<h1>Internal Server Error</h1>
|
||||||
@@ -43,10 +45,10 @@ INTERNALFAIL;
|
|||||||
|
|
||||||
echo "</pre></p></body></html>";
|
echo "</pre></p></body></html>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function failInternalError($sError, $sSQL = false, $vDumpVar = false)
|
function failInternalError($sError, $sSQL = false, $vDumpVar = false)
|
||||||
{
|
{
|
||||||
header('HTTP/1.0 500 Internal Server Error');
|
header('HTTP/1.0 500 Internal Server Error');
|
||||||
header('Content-type: text/html; charset=utf-8');
|
header('Content-type: text/html; charset=utf-8');
|
||||||
echo "<html><body><h1>Internal Server Error</h1>";
|
echo "<html><body><h1>Internal Server Error</h1>";
|
||||||
@@ -69,11 +71,11 @@ INTERNALFAIL;
|
|||||||
}
|
}
|
||||||
echo "\n</body></html>\n";
|
echo "\n</body></html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function userError($sError)
|
function userError($sError)
|
||||||
{
|
{
|
||||||
header('HTTP/1.0 400 Bad Request');
|
header('HTTP/1.0 400 Bad Request');
|
||||||
header('Content-type: text/html; charset=utf-8');
|
header('Content-type: text/html; charset=utf-8');
|
||||||
echo "<html><body><h1>Bad Request</h1>";
|
echo "<html><body><h1>Bad Request</h1>";
|
||||||
@@ -82,23 +84,23 @@ INTERNALFAIL;
|
|||||||
echo '<p>If you feel this error is incorrect feel file an issue on <a href="https://github.com/twain47/Nominatim/issues">Github</a>. Please include the error message above and the URL you used.</p>';
|
echo '<p>If you feel this error is incorrect feel file an issue on <a href="https://github.com/twain47/Nominatim/issues">Github</a>. Please include the error message above and the URL you used.</p>';
|
||||||
echo "\n</body></html>\n";
|
echo "\n</body></html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* HTTP Reply header setup
|
* HTTP Reply header setup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (CONST_NoAccessControl)
|
if (CONST_NoAccessControl)
|
||||||
{
|
{
|
||||||
header("Access-Control-Allow-Origin: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
header("Access-Control-Allow-Methods: OPTIONS,GET");
|
header("Access-Control-Allow-Methods: OPTIONS,GET");
|
||||||
if (!empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
|
if (!empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
|
||||||
{
|
{
|
||||||
header("Access-Control-Allow-Headers: ".$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
|
header("Access-Control-Allow-Headers: ".$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit;
|
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit;
|
||||||
|
|
||||||
if (CONST_Debug) header('Content-type: text/html; charset=utf-8');
|
if (CONST_Debug) header('Content-type: text/html; charset=utf-8');
|
||||||
|
|
||||||
|
|||||||
10
lib/init.php
10
lib/init.php
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(CONST_BasePath.'/lib/lib.php');
|
require_once(CONST_BasePath.'/lib/lib.php');
|
||||||
require_once(CONST_BasePath.'/lib/db.php');
|
require_once(CONST_BasePath.'/lib/db.php');
|
||||||
|
|
||||||
if (get_magic_quotes_gpc())
|
if (get_magic_quotes_gpc())
|
||||||
{
|
{
|
||||||
echo "Please disable magic quotes in your php.ini configuration\n";
|
echo "Please disable magic quotes in your php.ini configuration\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
722
lib/lib.php
722
lib/lib.php
@@ -1,57 +1,57 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function fail($sError, $sUserError = false)
|
function fail($sError, $sUserError = false)
|
||||||
{
|
{
|
||||||
if (!$sUserError) $sUserError = $sError;
|
if (!$sUserError) $sUserError = $sError;
|
||||||
error_log('ERROR: '.$sError);
|
error_log('ERROR: '.$sError);
|
||||||
echo $sUserError."\n";
|
echo $sUserError."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getProcessorCount()
|
function getProcessorCount()
|
||||||
{
|
{
|
||||||
$sCPU = file_get_contents('/proc/cpuinfo');
|
$sCPU = file_get_contents('/proc/cpuinfo');
|
||||||
preg_match_all('#processor\s+: [0-9]+#', $sCPU, $aMatches);
|
preg_match_all('#processor\s+: [0-9]+#', $sCPU, $aMatches);
|
||||||
return sizeof($aMatches[0]);
|
return sizeof($aMatches[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getTotalMemoryMB()
|
function getTotalMemoryMB()
|
||||||
{
|
{
|
||||||
$sCPU = file_get_contents('/proc/meminfo');
|
$sCPU = file_get_contents('/proc/meminfo');
|
||||||
preg_match('#MemTotal: +([0-9]+) kB#', $sCPU, $aMatches);
|
preg_match('#MemTotal: +([0-9]+) kB#', $sCPU, $aMatches);
|
||||||
return (int)($aMatches[1]/1024);
|
return (int)($aMatches[1]/1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getCacheMemoryMB()
|
function getCacheMemoryMB()
|
||||||
{
|
{
|
||||||
$sCPU = file_get_contents('/proc/meminfo');
|
$sCPU = file_get_contents('/proc/meminfo');
|
||||||
preg_match('#Cached: +([0-9]+) kB#', $sCPU, $aMatches);
|
preg_match('#Cached: +([0-9]+) kB#', $sCPU, $aMatches);
|
||||||
return (int)($aMatches[1]/1024);
|
return (int)($aMatches[1]/1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function bySearchRank($a, $b)
|
function bySearchRank($a, $b)
|
||||||
{
|
{
|
||||||
if ($a['iSearchRank'] == $b['iSearchRank'])
|
if ($a['iSearchRank'] == $b['iSearchRank'])
|
||||||
return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
|
return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
|
||||||
return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
|
return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function byImportance($a, $b)
|
function byImportance($a, $b)
|
||||||
{
|
{
|
||||||
if ($a['importance'] != $b['importance'])
|
if ($a['importance'] != $b['importance'])
|
||||||
return ($a['importance'] > $b['importance']?-1:1);
|
return ($a['importance'] > $b['importance']?-1:1);
|
||||||
|
|
||||||
return ($a['foundorder'] < $b['foundorder']?-1:1);
|
return ($a['foundorder'] < $b['foundorder']?-1:1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getWordSets($aWords, $iDepth)
|
function getWordSets($aWords, $iDepth)
|
||||||
{
|
{
|
||||||
$aResult = array(array(join(' ',$aWords)));
|
$aResult = array(array(join(' ',$aWords)));
|
||||||
$sFirstToken = '';
|
$sFirstToken = '';
|
||||||
if ($iDepth < 8) {
|
if ($iDepth < 8) {
|
||||||
@@ -67,10 +67,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInverseWordSets($aWords, $iDepth)
|
function getInverseWordSets($aWords, $iDepth)
|
||||||
{
|
{
|
||||||
$aResult = array(array(join(' ',$aWords)));
|
$aResult = array(array(join(' ',$aWords)));
|
||||||
$sFirstToken = '';
|
$sFirstToken = '';
|
||||||
if ($iDepth < 8)
|
if ($iDepth < 8)
|
||||||
@@ -87,11 +87,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getTokensFromSets($aSets)
|
function getTokensFromSets($aSets)
|
||||||
{
|
{
|
||||||
$aTokens = array();
|
$aTokens = array();
|
||||||
foreach($aSets as $aSet)
|
foreach($aSets as $aSet)
|
||||||
{
|
{
|
||||||
@@ -102,15 +102,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $aTokens;
|
return $aTokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GB Postcode functions
|
GB Postcode functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function gbPostcodeCalculate($sPostcode, $sPostcodeSector, $sPostcodeEnd, &$oDB)
|
function gbPostcodeCalculate($sPostcode, $sPostcodeSector, $sPostcodeEnd, &$oDB)
|
||||||
{
|
{
|
||||||
// Try an exact match on the gb_postcode table
|
// Try an exact match on the gb_postcode table
|
||||||
$sSQL = 'select \'AA\', ST_X(ST_Centroid(geometry)) as lon,ST_Y(ST_Centroid(geometry)) as lat from gb_postcode where postcode = \''.$sPostcode.'\'';
|
$sSQL = 'select \'AA\', ST_X(ST_Centroid(geometry)) as lon,ST_Y(ST_Centroid(geometry)) as lat from gb_postcode where postcode = \''.$sPostcode.'\'';
|
||||||
$aNearPostcodes = chksql($oDB->getAll($sSQL));
|
$aNearPostcodes = chksql($oDB->getAll($sSQL));
|
||||||
@@ -127,319 +127,319 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getClassTypes()
|
function getClassTypes()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'boundary:administrative:1' => array('label'=>'Continent','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:1' => array('label'=>'Continent','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:2' => array('label'=>'Country','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:2' => array('label'=>'Country','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'place:country' => array('label'=>'Country','frequency'=>0,'icon'=>'poi_boundary_administrative','defzoom'=>6, 'defdiameter' => 15,),
|
'place:country' => array('label'=>'Country','frequency'=>0,'icon'=>'poi_boundary_administrative','defzoom'=>6, 'defdiameter' => 15,),
|
||||||
'boundary:administrative:3' => array('label'=>'State','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:3' => array('label'=>'State','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:4' => array('label'=>'State','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:4' => array('label'=>'State','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'place:state' => array('label'=>'State','frequency'=>0,'icon'=>'poi_boundary_administrative','defzoom'=>8, 'defdiameter' => 5.12,),
|
'place:state' => array('label'=>'State','frequency'=>0,'icon'=>'poi_boundary_administrative','defzoom'=>8, 'defdiameter' => 5.12,),
|
||||||
'boundary:administrative:5' => array('label'=>'State District','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:5' => array('label'=>'State District','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:6' => array('label'=>'County','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:6' => array('label'=>'County','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:7' => array('label'=>'County','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:7' => array('label'=>'County','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'place:county' => array('label'=>'County','frequency'=>108,'icon'=>'poi_boundary_administrative','defzoom'=>10, 'defdiameter' => 1.28,),
|
'place:county' => array('label'=>'County','frequency'=>108,'icon'=>'poi_boundary_administrative','defzoom'=>10, 'defdiameter' => 1.28,),
|
||||||
'boundary:administrative:8' => array('label'=>'City','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:8' => array('label'=>'City','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'place:city' => array('label'=>'City','frequency'=>66,'icon'=>'poi_place_city','defzoom'=>12, 'defdiameter' => 0.32,),
|
'place:city' => array('label'=>'City','frequency'=>66,'icon'=>'poi_place_city','defzoom'=>12, 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:9' => array('label'=>'City District','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:9' => array('label'=>'City District','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:10' => array('label'=>'Suburb','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:10' => array('label'=>'Suburb','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:administrative:11' => array('label'=>'Neighbourhood','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative:11' => array('label'=>'Neighbourhood','frequency'=>0,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'place:region' => array('label'=>'Region','frequency'=>0,'icon'=>'poi_boundary_administrative','defzoom'=>8, 'defdiameter' => 0.04,),
|
'place:region' => array('label'=>'Region','frequency'=>0,'icon'=>'poi_boundary_administrative','defzoom'=>8, 'defdiameter' => 0.04,),
|
||||||
'place:island' => array('label'=>'Island','frequency'=>288,'icon'=>'','defzoom'=>11, 'defdiameter' => 0.64,),
|
'place:island' => array('label'=>'Island','frequency'=>288,'icon'=>'','defzoom'=>11, 'defdiameter' => 0.64,),
|
||||||
'boundary:administrative' => array('label'=>'Administrative','frequency'=>413,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:administrative' => array('label'=>'Administrative','frequency'=>413,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'boundary:postal_code' => array('label'=>'Postcode','frequency'=>413,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
'boundary:postal_code' => array('label'=>'Postcode','frequency'=>413,'icon'=>'poi_boundary_administrative', 'defdiameter' => 0.32,),
|
||||||
'place:town' => array('label'=>'Town','frequency'=>1497,'icon'=>'poi_place_town','defzoom'=>14, 'defdiameter' => 0.08,),
|
'place:town' => array('label'=>'Town','frequency'=>1497,'icon'=>'poi_place_town','defzoom'=>14, 'defdiameter' => 0.08,),
|
||||||
'place:village' => array('label'=>'Village','frequency'=>11230,'icon'=>'poi_place_village','defzoom'=>15, 'defdiameter' => 0.04,),
|
'place:village' => array('label'=>'Village','frequency'=>11230,'icon'=>'poi_place_village','defzoom'=>15, 'defdiameter' => 0.04,),
|
||||||
'place:hamlet' => array('label'=>'Hamlet','frequency'=>7075,'icon'=>'poi_place_village','defzoom'=>15, 'defdiameter' => 0.04,),
|
'place:hamlet' => array('label'=>'Hamlet','frequency'=>7075,'icon'=>'poi_place_village','defzoom'=>15, 'defdiameter' => 0.04,),
|
||||||
'place:suburb' => array('label'=>'Suburb','frequency'=>2528,'icon'=>'poi_place_village', 'defdiameter' => 0.04,),
|
'place:suburb' => array('label'=>'Suburb','frequency'=>2528,'icon'=>'poi_place_village', 'defdiameter' => 0.04,),
|
||||||
'place:locality' => array('label'=>'Locality','frequency'=>4113,'icon'=>'poi_place_village', 'defdiameter' => 0.02,),
|
'place:locality' => array('label'=>'Locality','frequency'=>4113,'icon'=>'poi_place_village', 'defdiameter' => 0.02,),
|
||||||
'landuse:farm' => array('label'=>'Farm','frequency'=>1201,'icon'=>'', 'defdiameter' => 0.02,),
|
'landuse:farm' => array('label'=>'Farm','frequency'=>1201,'icon'=>'', 'defdiameter' => 0.02,),
|
||||||
'place:farm' => array('label'=>'Farm','frequency'=>1162,'icon'=>'', 'defdiameter' => 0.02,),
|
'place:farm' => array('label'=>'Farm','frequency'=>1162,'icon'=>'', 'defdiameter' => 0.02,),
|
||||||
|
|
||||||
'highway:motorway_junction' => array('label'=>'Motorway Junction','frequency'=>1126,'icon'=>'','simplelabel'=>'Junction',),
|
'highway:motorway_junction' => array('label'=>'Motorway Junction','frequency'=>1126,'icon'=>'','simplelabel'=>'Junction',),
|
||||||
'highway:motorway' => array('label'=>'Motorway','frequency'=>4627,'icon'=>'','simplelabel'=>'Road',),
|
'highway:motorway' => array('label'=>'Motorway','frequency'=>4627,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:trunk' => array('label'=>'Trunk','frequency'=>23084,'icon'=>'','simplelabel'=>'Road',),
|
'highway:trunk' => array('label'=>'Trunk','frequency'=>23084,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:primary' => array('label'=>'Primary','frequency'=>32138,'icon'=>'','simplelabel'=>'Road',),
|
'highway:primary' => array('label'=>'Primary','frequency'=>32138,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:secondary' => array('label'=>'Secondary','frequency'=>25807,'icon'=>'','simplelabel'=>'Road',),
|
'highway:secondary' => array('label'=>'Secondary','frequency'=>25807,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:tertiary' => array('label'=>'Tertiary','frequency'=>29829,'icon'=>'','simplelabel'=>'Road',),
|
'highway:tertiary' => array('label'=>'Tertiary','frequency'=>29829,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:residential' => array('label'=>'Residential','frequency'=>361498,'icon'=>'','simplelabel'=>'Road',),
|
'highway:residential' => array('label'=>'Residential','frequency'=>361498,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:unclassified' => array('label'=>'Unclassified','frequency'=>66441,'icon'=>'','simplelabel'=>'Road',),
|
'highway:unclassified' => array('label'=>'Unclassified','frequency'=>66441,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:living_street' => array('label'=>'Living Street','frequency'=>710,'icon'=>'','simplelabel'=>'Road',),
|
'highway:living_street' => array('label'=>'Living Street','frequency'=>710,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:service' => array('label'=>'Service','frequency'=>9963,'icon'=>'','simplelabel'=>'Road',),
|
'highway:service' => array('label'=>'Service','frequency'=>9963,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:track' => array('label'=>'Track','frequency'=>2565,'icon'=>'','simplelabel'=>'Road',),
|
'highway:track' => array('label'=>'Track','frequency'=>2565,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:road' => array('label'=>'Road','frequency'=>591,'icon'=>'','simplelabel'=>'Road',),
|
'highway:road' => array('label'=>'Road','frequency'=>591,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:byway' => array('label'=>'Byway','frequency'=>346,'icon'=>'','simplelabel'=>'Road',),
|
'highway:byway' => array('label'=>'Byway','frequency'=>346,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:bridleway' => array('label'=>'Bridleway','frequency'=>1556,'icon'=>'',),
|
'highway:bridleway' => array('label'=>'Bridleway','frequency'=>1556,'icon'=>'',),
|
||||||
'highway:cycleway' => array('label'=>'Cycleway','frequency'=>2419,'icon'=>'',),
|
'highway:cycleway' => array('label'=>'Cycleway','frequency'=>2419,'icon'=>'',),
|
||||||
'highway:pedestrian' => array('label'=>'Pedestrian','frequency'=>2757,'icon'=>'',),
|
'highway:pedestrian' => array('label'=>'Pedestrian','frequency'=>2757,'icon'=>'',),
|
||||||
'highway:footway' => array('label'=>'Footway','frequency'=>15008,'icon'=>'',),
|
'highway:footway' => array('label'=>'Footway','frequency'=>15008,'icon'=>'',),
|
||||||
'highway:steps' => array('label'=>'Steps','frequency'=>444,'icon'=>'','simplelabel'=>'Footway',),
|
'highway:steps' => array('label'=>'Steps','frequency'=>444,'icon'=>'','simplelabel'=>'Footway',),
|
||||||
'highway:motorway_link' => array('label'=>'Motorway Link','frequency'=>795,'icon'=>'','simplelabel'=>'Road',),
|
'highway:motorway_link' => array('label'=>'Motorway Link','frequency'=>795,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:trunk_link' => array('label'=>'Trunk Link','frequency'=>1258,'icon'=>'','simplelabel'=>'Road',),
|
'highway:trunk_link' => array('label'=>'Trunk Link','frequency'=>1258,'icon'=>'','simplelabel'=>'Road',),
|
||||||
'highway:primary_link' => array('label'=>'Primary Link','frequency'=>313,'icon'=>'','simplelabel'=>'Road',),
|
'highway:primary_link' => array('label'=>'Primary Link','frequency'=>313,'icon'=>'','simplelabel'=>'Road',),
|
||||||
|
|
||||||
'landuse:industrial' => array('label'=>'Industrial','frequency'=>1062,'icon'=>'',),
|
'landuse:industrial' => array('label'=>'Industrial','frequency'=>1062,'icon'=>'',),
|
||||||
'landuse:residential' => array('label'=>'Residential','frequency'=>886,'icon'=>'',),
|
'landuse:residential' => array('label'=>'Residential','frequency'=>886,'icon'=>'',),
|
||||||
'landuse:retail' => array('label'=>'Retail','frequency'=>754,'icon'=>'',),
|
'landuse:retail' => array('label'=>'Retail','frequency'=>754,'icon'=>'',),
|
||||||
'landuse:commercial' => array('label'=>'Commercial','frequency'=>657,'icon'=>'',),
|
'landuse:commercial' => array('label'=>'Commercial','frequency'=>657,'icon'=>'',),
|
||||||
|
|
||||||
'place:airport' => array('label'=>'Airport','frequency'=>36,'icon'=>'transport_airport2', 'defdiameter' => 0.03,),
|
'place:airport' => array('label'=>'Airport','frequency'=>36,'icon'=>'transport_airport2', 'defdiameter' => 0.03,),
|
||||||
'aeroway:aerodrome' => array('label'=>'Aerodrome','frequency'=>36,'icon'=>'transport_airport2', 'defdiameter' => 0.03,),
|
'aeroway:aerodrome' => array('label'=>'Aerodrome','frequency'=>36,'icon'=>'transport_airport2', 'defdiameter' => 0.03,),
|
||||||
'aeroway' => array('label'=>'Aeroway','frequency'=>36,'icon'=>'transport_airport2', 'defdiameter' => 0.03,),
|
'aeroway' => array('label'=>'Aeroway','frequency'=>36,'icon'=>'transport_airport2', 'defdiameter' => 0.03,),
|
||||||
'railway:station' => array('label'=>'Station','frequency'=>3431,'icon'=>'transport_train_station2', 'defdiameter' => 0.01,),
|
'railway:station' => array('label'=>'Station','frequency'=>3431,'icon'=>'transport_train_station2', 'defdiameter' => 0.01,),
|
||||||
'amenity:place_of_worship' => array('label'=>'Place Of Worship','frequency'=>9049,'icon'=>'place_of_worship_unknown3',),
|
'amenity:place_of_worship' => array('label'=>'Place Of Worship','frequency'=>9049,'icon'=>'place_of_worship_unknown3',),
|
||||||
'amenity:pub' => array('label'=>'Pub','frequency'=>18969,'icon'=>'food_pub',),
|
'amenity:pub' => array('label'=>'Pub','frequency'=>18969,'icon'=>'food_pub',),
|
||||||
'amenity:bar' => array('label'=>'Bar','frequency'=>164,'icon'=>'food_bar',),
|
'amenity:bar' => array('label'=>'Bar','frequency'=>164,'icon'=>'food_bar',),
|
||||||
'amenity:university' => array('label'=>'University','frequency'=>607,'icon'=>'education_university',),
|
'amenity:university' => array('label'=>'University','frequency'=>607,'icon'=>'education_university',),
|
||||||
'tourism:museum' => array('label'=>'Museum','frequency'=>543,'icon'=>'tourist_museum',),
|
'tourism:museum' => array('label'=>'Museum','frequency'=>543,'icon'=>'tourist_museum',),
|
||||||
'amenity:arts_centre' => array('label'=>'Arts Centre','frequency'=>136,'icon'=>'tourist_art_gallery2',),
|
'amenity:arts_centre' => array('label'=>'Arts Centre','frequency'=>136,'icon'=>'tourist_art_gallery2',),
|
||||||
'tourism:zoo' => array('label'=>'Zoo','frequency'=>47,'icon'=>'tourist_zoo',),
|
'tourism:zoo' => array('label'=>'Zoo','frequency'=>47,'icon'=>'tourist_zoo',),
|
||||||
'tourism:theme_park' => array('label'=>'Theme Park','frequency'=>24,'icon'=>'poi_point_of_interest',),
|
'tourism:theme_park' => array('label'=>'Theme Park','frequency'=>24,'icon'=>'poi_point_of_interest',),
|
||||||
'tourism:attraction' => array('label'=>'Attraction','frequency'=>1463,'icon'=>'poi_point_of_interest',),
|
'tourism:attraction' => array('label'=>'Attraction','frequency'=>1463,'icon'=>'poi_point_of_interest',),
|
||||||
'leisure:golf_course' => array('label'=>'Golf Course','frequency'=>712,'icon'=>'sport_golf',),
|
'leisure:golf_course' => array('label'=>'Golf Course','frequency'=>712,'icon'=>'sport_golf',),
|
||||||
'historic:castle' => array('label'=>'Castle','frequency'=>316,'icon'=>'tourist_castle',),
|
'historic:castle' => array('label'=>'Castle','frequency'=>316,'icon'=>'tourist_castle',),
|
||||||
'amenity:hospital' => array('label'=>'Hospital','frequency'=>879,'icon'=>'health_hospital',),
|
'amenity:hospital' => array('label'=>'Hospital','frequency'=>879,'icon'=>'health_hospital',),
|
||||||
'amenity:school' => array('label'=>'School','frequency'=>8192,'icon'=>'education_school',),
|
'amenity:school' => array('label'=>'School','frequency'=>8192,'icon'=>'education_school',),
|
||||||
'amenity:theatre' => array('label'=>'Theatre','frequency'=>371,'icon'=>'tourist_theatre',),
|
'amenity:theatre' => array('label'=>'Theatre','frequency'=>371,'icon'=>'tourist_theatre',),
|
||||||
'amenity:public_building' => array('label'=>'Public Building','frequency'=>985,'icon'=>'',),
|
'amenity:public_building' => array('label'=>'Public Building','frequency'=>985,'icon'=>'',),
|
||||||
'amenity:library' => array('label'=>'Library','frequency'=>794,'icon'=>'amenity_library',),
|
'amenity:library' => array('label'=>'Library','frequency'=>794,'icon'=>'amenity_library',),
|
||||||
'amenity:townhall' => array('label'=>'Townhall','frequency'=>242,'icon'=>'',),
|
'amenity:townhall' => array('label'=>'Townhall','frequency'=>242,'icon'=>'',),
|
||||||
'amenity:community_centre' => array('label'=>'Community Centre','frequency'=>157,'icon'=>'',),
|
'amenity:community_centre' => array('label'=>'Community Centre','frequency'=>157,'icon'=>'',),
|
||||||
'amenity:fire_station' => array('label'=>'Fire Station','frequency'=>221,'icon'=>'amenity_firestation3',),
|
'amenity:fire_station' => array('label'=>'Fire Station','frequency'=>221,'icon'=>'amenity_firestation3',),
|
||||||
'amenity:police' => array('label'=>'Police','frequency'=>334,'icon'=>'amenity_police2',),
|
'amenity:police' => array('label'=>'Police','frequency'=>334,'icon'=>'amenity_police2',),
|
||||||
'amenity:bank' => array('label'=>'Bank','frequency'=>1248,'icon'=>'money_bank2',),
|
'amenity:bank' => array('label'=>'Bank','frequency'=>1248,'icon'=>'money_bank2',),
|
||||||
'amenity:post_office' => array('label'=>'Post Office','frequency'=>859,'icon'=>'amenity_post_office',),
|
'amenity:post_office' => array('label'=>'Post Office','frequency'=>859,'icon'=>'amenity_post_office',),
|
||||||
'leisure:park' => array('label'=>'Park','frequency'=>2378,'icon'=>'',),
|
'leisure:park' => array('label'=>'Park','frequency'=>2378,'icon'=>'',),
|
||||||
'amenity:park' => array('label'=>'Park','frequency'=>53,'icon'=>'',),
|
'amenity:park' => array('label'=>'Park','frequency'=>53,'icon'=>'',),
|
||||||
'landuse:park' => array('label'=>'Park','frequency'=>50,'icon'=>'',),
|
'landuse:park' => array('label'=>'Park','frequency'=>50,'icon'=>'',),
|
||||||
'landuse:recreation_ground' => array('label'=>'Recreation Ground','frequency'=>517,'icon'=>'',),
|
'landuse:recreation_ground' => array('label'=>'Recreation Ground','frequency'=>517,'icon'=>'',),
|
||||||
'tourism:hotel' => array('label'=>'Hotel','frequency'=>2150,'icon'=>'accommodation_hotel2',),
|
'tourism:hotel' => array('label'=>'Hotel','frequency'=>2150,'icon'=>'accommodation_hotel2',),
|
||||||
'tourism:motel' => array('label'=>'Motel','frequency'=>43,'icon'=>'',),
|
'tourism:motel' => array('label'=>'Motel','frequency'=>43,'icon'=>'',),
|
||||||
'amenity:cinema' => array('label'=>'Cinema','frequency'=>277,'icon'=>'tourist_cinema',),
|
'amenity:cinema' => array('label'=>'Cinema','frequency'=>277,'icon'=>'tourist_cinema',),
|
||||||
'tourism:artwork' => array('label'=>'Artwork','frequency'=>171,'icon'=>'tourist_art_gallery2',),
|
'tourism:artwork' => array('label'=>'Artwork','frequency'=>171,'icon'=>'tourist_art_gallery2',),
|
||||||
'historic:archaeological_site' => array('label'=>'Archaeological Site','frequency'=>407,'icon'=>'tourist_archaeological2',),
|
'historic:archaeological_site' => array('label'=>'Archaeological Site','frequency'=>407,'icon'=>'tourist_archaeological2',),
|
||||||
'amenity:doctors' => array('label'=>'Doctors','frequency'=>581,'icon'=>'health_doctors',),
|
'amenity:doctors' => array('label'=>'Doctors','frequency'=>581,'icon'=>'health_doctors',),
|
||||||
'leisure:sports_centre' => array('label'=>'Sports Centre','frequency'=>767,'icon'=>'sport_leisure_centre',),
|
'leisure:sports_centre' => array('label'=>'Sports Centre','frequency'=>767,'icon'=>'sport_leisure_centre',),
|
||||||
'leisure:swimming_pool' => array('label'=>'Swimming Pool','frequency'=>24,'icon'=>'sport_swimming_outdoor',),
|
'leisure:swimming_pool' => array('label'=>'Swimming Pool','frequency'=>24,'icon'=>'sport_swimming_outdoor',),
|
||||||
'shop:supermarket' => array('label'=>'Supermarket','frequency'=>2673,'icon'=>'shopping_supermarket',),
|
'shop:supermarket' => array('label'=>'Supermarket','frequency'=>2673,'icon'=>'shopping_supermarket',),
|
||||||
'shop:convenience' => array('label'=>'Convenience','frequency'=>1469,'icon'=>'shopping_convenience',),
|
'shop:convenience' => array('label'=>'Convenience','frequency'=>1469,'icon'=>'shopping_convenience',),
|
||||||
'amenity:restaurant' => array('label'=>'Restaurant','frequency'=>3179,'icon'=>'food_restaurant',),
|
'amenity:restaurant' => array('label'=>'Restaurant','frequency'=>3179,'icon'=>'food_restaurant',),
|
||||||
'amenity:fast_food' => array('label'=>'Fast Food','frequency'=>2289,'icon'=>'food_fastfood',),
|
'amenity:fast_food' => array('label'=>'Fast Food','frequency'=>2289,'icon'=>'food_fastfood',),
|
||||||
'amenity:cafe' => array('label'=>'Cafe','frequency'=>1780,'icon'=>'food_cafe',),
|
'amenity:cafe' => array('label'=>'Cafe','frequency'=>1780,'icon'=>'food_cafe',),
|
||||||
'tourism:guest_house' => array('label'=>'Guest House','frequency'=>223,'icon'=>'accommodation_bed_and_breakfast',),
|
'tourism:guest_house' => array('label'=>'Guest House','frequency'=>223,'icon'=>'accommodation_bed_and_breakfast',),
|
||||||
'amenity:pharmacy' => array('label'=>'Pharmacy','frequency'=>733,'icon'=>'health_pharmacy_dispensing',),
|
'amenity:pharmacy' => array('label'=>'Pharmacy','frequency'=>733,'icon'=>'health_pharmacy_dispensing',),
|
||||||
'amenity:fuel' => array('label'=>'Fuel','frequency'=>1308,'icon'=>'transport_fuel',),
|
'amenity:fuel' => array('label'=>'Fuel','frequency'=>1308,'icon'=>'transport_fuel',),
|
||||||
'natural:peak' => array('label'=>'Peak','frequency'=>3212,'icon'=>'poi_peak',),
|
'natural:peak' => array('label'=>'Peak','frequency'=>3212,'icon'=>'poi_peak',),
|
||||||
'waterway:waterfall' => array('label'=>'Waterfall','frequency'=>24,'icon'=>'',),
|
'waterway:waterfall' => array('label'=>'Waterfall','frequency'=>24,'icon'=>'',),
|
||||||
'natural:wood' => array('label'=>'Wood','frequency'=>1845,'icon'=>'landuse_coniferous_and_deciduous',),
|
'natural:wood' => array('label'=>'Wood','frequency'=>1845,'icon'=>'landuse_coniferous_and_deciduous',),
|
||||||
'natural:water' => array('label'=>'Water','frequency'=>1790,'icon'=>'',),
|
'natural:water' => array('label'=>'Water','frequency'=>1790,'icon'=>'',),
|
||||||
'landuse:forest' => array('label'=>'Forest','frequency'=>467,'icon'=>'',),
|
'landuse:forest' => array('label'=>'Forest','frequency'=>467,'icon'=>'',),
|
||||||
'landuse:cemetery' => array('label'=>'Cemetery','frequency'=>463,'icon'=>'',),
|
'landuse:cemetery' => array('label'=>'Cemetery','frequency'=>463,'icon'=>'',),
|
||||||
'landuse:allotments' => array('label'=>'Allotments','frequency'=>408,'icon'=>'',),
|
'landuse:allotments' => array('label'=>'Allotments','frequency'=>408,'icon'=>'',),
|
||||||
'landuse:farmyard' => array('label'=>'Farmyard','frequency'=>397,'icon'=>'',),
|
'landuse:farmyard' => array('label'=>'Farmyard','frequency'=>397,'icon'=>'',),
|
||||||
'railway:rail' => array('label'=>'Rail','frequency'=>4894,'icon'=>'',),
|
'railway:rail' => array('label'=>'Rail','frequency'=>4894,'icon'=>'',),
|
||||||
'waterway:canal' => array('label'=>'Canal','frequency'=>1723,'icon'=>'',),
|
'waterway:canal' => array('label'=>'Canal','frequency'=>1723,'icon'=>'',),
|
||||||
'waterway:river' => array('label'=>'River','frequency'=>4089,'icon'=>'',),
|
'waterway:river' => array('label'=>'River','frequency'=>4089,'icon'=>'',),
|
||||||
'waterway:stream' => array('label'=>'Stream','frequency'=>2684,'icon'=>'',),
|
'waterway:stream' => array('label'=>'Stream','frequency'=>2684,'icon'=>'',),
|
||||||
'shop:bicycle' => array('label'=>'Bicycle','frequency'=>349,'icon'=>'shopping_bicycle',),
|
'shop:bicycle' => array('label'=>'Bicycle','frequency'=>349,'icon'=>'shopping_bicycle',),
|
||||||
'shop:clothes' => array('label'=>'Clothes','frequency'=>315,'icon'=>'shopping_clothes',),
|
'shop:clothes' => array('label'=>'Clothes','frequency'=>315,'icon'=>'shopping_clothes',),
|
||||||
'shop:hairdresser' => array('label'=>'Hairdresser','frequency'=>312,'icon'=>'shopping_hairdresser',),
|
'shop:hairdresser' => array('label'=>'Hairdresser','frequency'=>312,'icon'=>'shopping_hairdresser',),
|
||||||
'shop:doityourself' => array('label'=>'Doityourself','frequency'=>247,'icon'=>'shopping_diy',),
|
'shop:doityourself' => array('label'=>'Doityourself','frequency'=>247,'icon'=>'shopping_diy',),
|
||||||
'shop:estate_agent' => array('label'=>'Estate Agent','frequency'=>162,'icon'=>'shopping_estateagent2',),
|
'shop:estate_agent' => array('label'=>'Estate Agent','frequency'=>162,'icon'=>'shopping_estateagent2',),
|
||||||
'shop:car' => array('label'=>'Car','frequency'=>159,'icon'=>'shopping_car',),
|
'shop:car' => array('label'=>'Car','frequency'=>159,'icon'=>'shopping_car',),
|
||||||
'shop:garden_centre' => array('label'=>'Garden Centre','frequency'=>143,'icon'=>'shopping_garden_centre',),
|
'shop:garden_centre' => array('label'=>'Garden Centre','frequency'=>143,'icon'=>'shopping_garden_centre',),
|
||||||
'shop:car_repair' => array('label'=>'Car Repair','frequency'=>141,'icon'=>'shopping_car_repair',),
|
'shop:car_repair' => array('label'=>'Car Repair','frequency'=>141,'icon'=>'shopping_car_repair',),
|
||||||
'shop:newsagent' => array('label'=>'Newsagent','frequency'=>132,'icon'=>'',),
|
'shop:newsagent' => array('label'=>'Newsagent','frequency'=>132,'icon'=>'',),
|
||||||
'shop:bakery' => array('label'=>'Bakery','frequency'=>129,'icon'=>'shopping_bakery',),
|
'shop:bakery' => array('label'=>'Bakery','frequency'=>129,'icon'=>'shopping_bakery',),
|
||||||
'shop:furniture' => array('label'=>'Furniture','frequency'=>124,'icon'=>'',),
|
'shop:furniture' => array('label'=>'Furniture','frequency'=>124,'icon'=>'',),
|
||||||
'shop:butcher' => array('label'=>'Butcher','frequency'=>105,'icon'=>'shopping_butcher',),
|
'shop:butcher' => array('label'=>'Butcher','frequency'=>105,'icon'=>'shopping_butcher',),
|
||||||
'shop:apparel' => array('label'=>'Apparel','frequency'=>98,'icon'=>'shopping_clothes',),
|
'shop:apparel' => array('label'=>'Apparel','frequency'=>98,'icon'=>'shopping_clothes',),
|
||||||
'shop:electronics' => array('label'=>'Electronics','frequency'=>96,'icon'=>'',),
|
'shop:electronics' => array('label'=>'Electronics','frequency'=>96,'icon'=>'',),
|
||||||
'shop:department_store' => array('label'=>'Department Store','frequency'=>86,'icon'=>'',),
|
'shop:department_store' => array('label'=>'Department Store','frequency'=>86,'icon'=>'',),
|
||||||
'shop:books' => array('label'=>'Books','frequency'=>85,'icon'=>'',),
|
'shop:books' => array('label'=>'Books','frequency'=>85,'icon'=>'',),
|
||||||
'shop:yes' => array('label'=>'Shop','frequency'=>68,'icon'=>'',),
|
'shop:yes' => array('label'=>'Shop','frequency'=>68,'icon'=>'',),
|
||||||
'shop:outdoor' => array('label'=>'Outdoor','frequency'=>67,'icon'=>'',),
|
'shop:outdoor' => array('label'=>'Outdoor','frequency'=>67,'icon'=>'',),
|
||||||
'shop:mall' => array('label'=>'Mall','frequency'=>63,'icon'=>'',),
|
'shop:mall' => array('label'=>'Mall','frequency'=>63,'icon'=>'',),
|
||||||
'shop:florist' => array('label'=>'Florist','frequency'=>61,'icon'=>'',),
|
'shop:florist' => array('label'=>'Florist','frequency'=>61,'icon'=>'',),
|
||||||
'shop:charity' => array('label'=>'Charity','frequency'=>60,'icon'=>'',),
|
'shop:charity' => array('label'=>'Charity','frequency'=>60,'icon'=>'',),
|
||||||
'shop:hardware' => array('label'=>'Hardware','frequency'=>59,'icon'=>'',),
|
'shop:hardware' => array('label'=>'Hardware','frequency'=>59,'icon'=>'',),
|
||||||
'shop:laundry' => array('label'=>'Laundry','frequency'=>51,'icon'=>'shopping_laundrette',),
|
'shop:laundry' => array('label'=>'Laundry','frequency'=>51,'icon'=>'shopping_laundrette',),
|
||||||
'shop:shoes' => array('label'=>'Shoes','frequency'=>49,'icon'=>'',),
|
'shop:shoes' => array('label'=>'Shoes','frequency'=>49,'icon'=>'',),
|
||||||
'shop:beverages' => array('label'=>'Beverages','frequency'=>48,'icon'=>'shopping_alcohol',),
|
'shop:beverages' => array('label'=>'Beverages','frequency'=>48,'icon'=>'shopping_alcohol',),
|
||||||
'shop:dry_cleaning' => array('label'=>'Dry Cleaning','frequency'=>46,'icon'=>'',),
|
'shop:dry_cleaning' => array('label'=>'Dry Cleaning','frequency'=>46,'icon'=>'',),
|
||||||
'shop:carpet' => array('label'=>'Carpet','frequency'=>45,'icon'=>'',),
|
'shop:carpet' => array('label'=>'Carpet','frequency'=>45,'icon'=>'',),
|
||||||
'shop:computer' => array('label'=>'Computer','frequency'=>44,'icon'=>'',),
|
'shop:computer' => array('label'=>'Computer','frequency'=>44,'icon'=>'',),
|
||||||
'shop:alcohol' => array('label'=>'Alcohol','frequency'=>44,'icon'=>'shopping_alcohol',),
|
'shop:alcohol' => array('label'=>'Alcohol','frequency'=>44,'icon'=>'shopping_alcohol',),
|
||||||
'shop:optician' => array('label'=>'Optician','frequency'=>55,'icon'=>'health_opticians',),
|
'shop:optician' => array('label'=>'Optician','frequency'=>55,'icon'=>'health_opticians',),
|
||||||
'shop:chemist' => array('label'=>'Chemist','frequency'=>42,'icon'=>'health_pharmacy',),
|
'shop:chemist' => array('label'=>'Chemist','frequency'=>42,'icon'=>'health_pharmacy',),
|
||||||
'shop:gallery' => array('label'=>'Gallery','frequency'=>38,'icon'=>'tourist_art_gallery2',),
|
'shop:gallery' => array('label'=>'Gallery','frequency'=>38,'icon'=>'tourist_art_gallery2',),
|
||||||
'shop:mobile_phone' => array('label'=>'Mobile Phone','frequency'=>37,'icon'=>'',),
|
'shop:mobile_phone' => array('label'=>'Mobile Phone','frequency'=>37,'icon'=>'',),
|
||||||
'shop:sports' => array('label'=>'Sports','frequency'=>37,'icon'=>'',),
|
'shop:sports' => array('label'=>'Sports','frequency'=>37,'icon'=>'',),
|
||||||
'shop:jewelry' => array('label'=>'Jewelry','frequency'=>32,'icon'=>'shopping_jewelry',),
|
'shop:jewelry' => array('label'=>'Jewelry','frequency'=>32,'icon'=>'shopping_jewelry',),
|
||||||
'shop:pet' => array('label'=>'Pet','frequency'=>29,'icon'=>'',),
|
'shop:pet' => array('label'=>'Pet','frequency'=>29,'icon'=>'',),
|
||||||
'shop:beauty' => array('label'=>'Beauty','frequency'=>28,'icon'=>'',),
|
'shop:beauty' => array('label'=>'Beauty','frequency'=>28,'icon'=>'',),
|
||||||
'shop:stationery' => array('label'=>'Stationery','frequency'=>25,'icon'=>'',),
|
'shop:stationery' => array('label'=>'Stationery','frequency'=>25,'icon'=>'',),
|
||||||
'shop:shopping_centre' => array('label'=>'Shopping Centre','frequency'=>25,'icon'=>'',),
|
'shop:shopping_centre' => array('label'=>'Shopping Centre','frequency'=>25,'icon'=>'',),
|
||||||
'shop:general' => array('label'=>'General','frequency'=>25,'icon'=>'',),
|
'shop:general' => array('label'=>'General','frequency'=>25,'icon'=>'',),
|
||||||
'shop:electrical' => array('label'=>'Electrical','frequency'=>25,'icon'=>'',),
|
'shop:electrical' => array('label'=>'Electrical','frequency'=>25,'icon'=>'',),
|
||||||
'shop:toys' => array('label'=>'Toys','frequency'=>23,'icon'=>'',),
|
'shop:toys' => array('label'=>'Toys','frequency'=>23,'icon'=>'',),
|
||||||
'shop:jeweller' => array('label'=>'Jeweller','frequency'=>23,'icon'=>'',),
|
'shop:jeweller' => array('label'=>'Jeweller','frequency'=>23,'icon'=>'',),
|
||||||
'shop:betting' => array('label'=>'Betting','frequency'=>23,'icon'=>'',),
|
'shop:betting' => array('label'=>'Betting','frequency'=>23,'icon'=>'',),
|
||||||
'shop:household' => array('label'=>'Household','frequency'=>21,'icon'=>'',),
|
'shop:household' => array('label'=>'Household','frequency'=>21,'icon'=>'',),
|
||||||
'shop:travel_agency' => array('label'=>'Travel Agency','frequency'=>21,'icon'=>'',),
|
'shop:travel_agency' => array('label'=>'Travel Agency','frequency'=>21,'icon'=>'',),
|
||||||
'shop:hifi' => array('label'=>'Hifi','frequency'=>21,'icon'=>'',),
|
'shop:hifi' => array('label'=>'Hifi','frequency'=>21,'icon'=>'',),
|
||||||
'amenity:shop' => array('label'=>'Shop','frequency'=>61,'icon'=>'',),
|
'amenity:shop' => array('label'=>'Shop','frequency'=>61,'icon'=>'',),
|
||||||
'tourism:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
|
'tourism:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
|
||||||
|
|
||||||
'place:house' => array('label'=>'House','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
'place:house' => array('label'=>'House','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
||||||
'place:house_name' => array('label'=>'House','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
'place:house_name' => array('label'=>'House','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
||||||
'place:house_number' => array('label'=>'House Number','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
'place:house_number' => array('label'=>'House Number','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
||||||
'place:country_code' => array('label'=>'Country Code','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
'place:country_code' => array('label'=>'Country Code','frequency'=>2086,'icon'=>'','defzoom'=>18,),
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
'leisure:pitch' => array('label'=>'Pitch','frequency'=>762,'icon'=>'',),
|
'leisure:pitch' => array('label'=>'Pitch','frequency'=>762,'icon'=>'',),
|
||||||
'highway:unsurfaced' => array('label'=>'Unsurfaced','frequency'=>492,'icon'=>'',),
|
'highway:unsurfaced' => array('label'=>'Unsurfaced','frequency'=>492,'icon'=>'',),
|
||||||
'historic:ruins' => array('label'=>'Ruins','frequency'=>483,'icon'=>'tourist_ruin',),
|
'historic:ruins' => array('label'=>'Ruins','frequency'=>483,'icon'=>'tourist_ruin',),
|
||||||
'amenity:college' => array('label'=>'College','frequency'=>473,'icon'=>'education_school',),
|
'amenity:college' => array('label'=>'College','frequency'=>473,'icon'=>'education_school',),
|
||||||
'historic:monument' => array('label'=>'Monument','frequency'=>470,'icon'=>'tourist_monument',),
|
'historic:monument' => array('label'=>'Monument','frequency'=>470,'icon'=>'tourist_monument',),
|
||||||
'railway:subway' => array('label'=>'Subway','frequency'=>385,'icon'=>'',),
|
'railway:subway' => array('label'=>'Subway','frequency'=>385,'icon'=>'',),
|
||||||
'historic:memorial' => array('label'=>'Memorial','frequency'=>382,'icon'=>'tourist_monument',),
|
'historic:memorial' => array('label'=>'Memorial','frequency'=>382,'icon'=>'tourist_monument',),
|
||||||
'leisure:nature_reserve' => array('label'=>'Nature Reserve','frequency'=>342,'icon'=>'',),
|
'leisure:nature_reserve' => array('label'=>'Nature Reserve','frequency'=>342,'icon'=>'',),
|
||||||
'leisure:common' => array('label'=>'Common','frequency'=>322,'icon'=>'',),
|
'leisure:common' => array('label'=>'Common','frequency'=>322,'icon'=>'',),
|
||||||
'waterway:lock_gate' => array('label'=>'Lock Gate','frequency'=>321,'icon'=>'',),
|
'waterway:lock_gate' => array('label'=>'Lock Gate','frequency'=>321,'icon'=>'',),
|
||||||
'natural:fell' => array('label'=>'Fell','frequency'=>308,'icon'=>'',),
|
'natural:fell' => array('label'=>'Fell','frequency'=>308,'icon'=>'',),
|
||||||
'amenity:nightclub' => array('label'=>'Nightclub','frequency'=>292,'icon'=>'',),
|
'amenity:nightclub' => array('label'=>'Nightclub','frequency'=>292,'icon'=>'',),
|
||||||
'highway:path' => array('label'=>'Path','frequency'=>287,'icon'=>'',),
|
'highway:path' => array('label'=>'Path','frequency'=>287,'icon'=>'',),
|
||||||
'leisure:garden' => array('label'=>'Garden','frequency'=>285,'icon'=>'',),
|
'leisure:garden' => array('label'=>'Garden','frequency'=>285,'icon'=>'',),
|
||||||
'landuse:reservoir' => array('label'=>'Reservoir','frequency'=>276,'icon'=>'',),
|
'landuse:reservoir' => array('label'=>'Reservoir','frequency'=>276,'icon'=>'',),
|
||||||
'leisure:playground' => array('label'=>'Playground','frequency'=>264,'icon'=>'',),
|
'leisure:playground' => array('label'=>'Playground','frequency'=>264,'icon'=>'',),
|
||||||
'leisure:stadium' => array('label'=>'Stadium','frequency'=>212,'icon'=>'',),
|
'leisure:stadium' => array('label'=>'Stadium','frequency'=>212,'icon'=>'',),
|
||||||
'historic:mine' => array('label'=>'Mine','frequency'=>193,'icon'=>'poi_mine',),
|
'historic:mine' => array('label'=>'Mine','frequency'=>193,'icon'=>'poi_mine',),
|
||||||
'natural:cliff' => array('label'=>'Cliff','frequency'=>193,'icon'=>'',),
|
'natural:cliff' => array('label'=>'Cliff','frequency'=>193,'icon'=>'',),
|
||||||
'tourism:caravan_site' => array('label'=>'Caravan Site','frequency'=>183,'icon'=>'accommodation_caravan_park',),
|
'tourism:caravan_site' => array('label'=>'Caravan Site','frequency'=>183,'icon'=>'accommodation_caravan_park',),
|
||||||
'amenity:bus_station' => array('label'=>'Bus Station','frequency'=>181,'icon'=>'transport_bus_station',),
|
'amenity:bus_station' => array('label'=>'Bus Station','frequency'=>181,'icon'=>'transport_bus_station',),
|
||||||
'amenity:kindergarten' => array('label'=>'Kindergarten','frequency'=>179,'icon'=>'',),
|
'amenity:kindergarten' => array('label'=>'Kindergarten','frequency'=>179,'icon'=>'',),
|
||||||
'highway:construction' => array('label'=>'Construction','frequency'=>176,'icon'=>'',),
|
'highway:construction' => array('label'=>'Construction','frequency'=>176,'icon'=>'',),
|
||||||
'amenity:atm' => array('label'=>'Atm','frequency'=>172,'icon'=>'money_atm2',),
|
'amenity:atm' => array('label'=>'Atm','frequency'=>172,'icon'=>'money_atm2',),
|
||||||
'amenity:emergency_phone' => array('label'=>'Emergency Phone','frequency'=>164,'icon'=>'',),
|
'amenity:emergency_phone' => array('label'=>'Emergency Phone','frequency'=>164,'icon'=>'',),
|
||||||
'waterway:lock' => array('label'=>'Lock','frequency'=>146,'icon'=>'',),
|
'waterway:lock' => array('label'=>'Lock','frequency'=>146,'icon'=>'',),
|
||||||
'waterway:riverbank' => array('label'=>'Riverbank','frequency'=>143,'icon'=>'',),
|
'waterway:riverbank' => array('label'=>'Riverbank','frequency'=>143,'icon'=>'',),
|
||||||
'natural:coastline' => array('label'=>'Coastline','frequency'=>142,'icon'=>'',),
|
'natural:coastline' => array('label'=>'Coastline','frequency'=>142,'icon'=>'',),
|
||||||
'tourism:viewpoint' => array('label'=>'Viewpoint','frequency'=>140,'icon'=>'tourist_view_point',),
|
'tourism:viewpoint' => array('label'=>'Viewpoint','frequency'=>140,'icon'=>'tourist_view_point',),
|
||||||
'tourism:hostel' => array('label'=>'Hostel','frequency'=>140,'icon'=>'',),
|
'tourism:hostel' => array('label'=>'Hostel','frequency'=>140,'icon'=>'',),
|
||||||
'tourism:bed_and_breakfast' => array('label'=>'Bed And Breakfast','frequency'=>140,'icon'=>'accommodation_bed_and_breakfast',),
|
'tourism:bed_and_breakfast' => array('label'=>'Bed And Breakfast','frequency'=>140,'icon'=>'accommodation_bed_and_breakfast',),
|
||||||
'railway:halt' => array('label'=>'Halt','frequency'=>135,'icon'=>'',),
|
'railway:halt' => array('label'=>'Halt','frequency'=>135,'icon'=>'',),
|
||||||
'railway:platform' => array('label'=>'Platform','frequency'=>134,'icon'=>'',),
|
'railway:platform' => array('label'=>'Platform','frequency'=>134,'icon'=>'',),
|
||||||
'railway:tram' => array('label'=>'Tram','frequency'=>130,'icon'=>'transport_tram_stop',),
|
'railway:tram' => array('label'=>'Tram','frequency'=>130,'icon'=>'transport_tram_stop',),
|
||||||
'amenity:courthouse' => array('label'=>'Courthouse','frequency'=>129,'icon'=>'amenity_court',),
|
'amenity:courthouse' => array('label'=>'Courthouse','frequency'=>129,'icon'=>'amenity_court',),
|
||||||
'amenity:recycling' => array('label'=>'Recycling','frequency'=>126,'icon'=>'amenity_recycling',),
|
'amenity:recycling' => array('label'=>'Recycling','frequency'=>126,'icon'=>'amenity_recycling',),
|
||||||
'amenity:dentist' => array('label'=>'Dentist','frequency'=>124,'icon'=>'health_dentist',),
|
'amenity:dentist' => array('label'=>'Dentist','frequency'=>124,'icon'=>'health_dentist',),
|
||||||
'natural:beach' => array('label'=>'Beach','frequency'=>121,'icon'=>'tourist_beach',),
|
'natural:beach' => array('label'=>'Beach','frequency'=>121,'icon'=>'tourist_beach',),
|
||||||
'place:moor' => array('label'=>'Moor','frequency'=>118,'icon'=>'',),
|
'place:moor' => array('label'=>'Moor','frequency'=>118,'icon'=>'',),
|
||||||
'amenity:grave_yard' => array('label'=>'Grave Yard','frequency'=>110,'icon'=>'',),
|
'amenity:grave_yard' => array('label'=>'Grave Yard','frequency'=>110,'icon'=>'',),
|
||||||
'waterway:drain' => array('label'=>'Drain','frequency'=>108,'icon'=>'',),
|
'waterway:drain' => array('label'=>'Drain','frequency'=>108,'icon'=>'',),
|
||||||
'landuse:grass' => array('label'=>'Grass','frequency'=>106,'icon'=>'',),
|
'landuse:grass' => array('label'=>'Grass','frequency'=>106,'icon'=>'',),
|
||||||
'landuse:village_green' => array('label'=>'Village Green','frequency'=>106,'icon'=>'',),
|
'landuse:village_green' => array('label'=>'Village Green','frequency'=>106,'icon'=>'',),
|
||||||
'natural:bay' => array('label'=>'Bay','frequency'=>102,'icon'=>'',),
|
'natural:bay' => array('label'=>'Bay','frequency'=>102,'icon'=>'',),
|
||||||
'railway:tram_stop' => array('label'=>'Tram Stop','frequency'=>101,'icon'=>'transport_tram_stop',),
|
'railway:tram_stop' => array('label'=>'Tram Stop','frequency'=>101,'icon'=>'transport_tram_stop',),
|
||||||
'leisure:marina' => array('label'=>'Marina','frequency'=>98,'icon'=>'',),
|
'leisure:marina' => array('label'=>'Marina','frequency'=>98,'icon'=>'',),
|
||||||
'highway:stile' => array('label'=>'Stile','frequency'=>97,'icon'=>'',),
|
'highway:stile' => array('label'=>'Stile','frequency'=>97,'icon'=>'',),
|
||||||
'natural:moor' => array('label'=>'Moor','frequency'=>95,'icon'=>'',),
|
'natural:moor' => array('label'=>'Moor','frequency'=>95,'icon'=>'',),
|
||||||
'railway:light_rail' => array('label'=>'Light Rail','frequency'=>91,'icon'=>'',),
|
'railway:light_rail' => array('label'=>'Light Rail','frequency'=>91,'icon'=>'',),
|
||||||
'railway:narrow_gauge' => array('label'=>'Narrow Gauge','frequency'=>90,'icon'=>'',),
|
'railway:narrow_gauge' => array('label'=>'Narrow Gauge','frequency'=>90,'icon'=>'',),
|
||||||
'natural:land' => array('label'=>'Land','frequency'=>86,'icon'=>'',),
|
'natural:land' => array('label'=>'Land','frequency'=>86,'icon'=>'',),
|
||||||
'amenity:village_hall' => array('label'=>'Village Hall','frequency'=>82,'icon'=>'',),
|
'amenity:village_hall' => array('label'=>'Village Hall','frequency'=>82,'icon'=>'',),
|
||||||
'waterway:dock' => array('label'=>'Dock','frequency'=>80,'icon'=>'',),
|
'waterway:dock' => array('label'=>'Dock','frequency'=>80,'icon'=>'',),
|
||||||
'amenity:veterinary' => array('label'=>'Veterinary','frequency'=>79,'icon'=>'',),
|
'amenity:veterinary' => array('label'=>'Veterinary','frequency'=>79,'icon'=>'',),
|
||||||
'landuse:brownfield' => array('label'=>'Brownfield','frequency'=>77,'icon'=>'',),
|
'landuse:brownfield' => array('label'=>'Brownfield','frequency'=>77,'icon'=>'',),
|
||||||
'leisure:track' => array('label'=>'Track','frequency'=>76,'icon'=>'',),
|
'leisure:track' => array('label'=>'Track','frequency'=>76,'icon'=>'',),
|
||||||
'railway:historic_station' => array('label'=>'Historic Station','frequency'=>74,'icon'=>'',),
|
'railway:historic_station' => array('label'=>'Historic Station','frequency'=>74,'icon'=>'',),
|
||||||
'landuse:construction' => array('label'=>'Construction','frequency'=>72,'icon'=>'',),
|
'landuse:construction' => array('label'=>'Construction','frequency'=>72,'icon'=>'',),
|
||||||
'amenity:prison' => array('label'=>'Prison','frequency'=>71,'icon'=>'amenity_prison',),
|
'amenity:prison' => array('label'=>'Prison','frequency'=>71,'icon'=>'amenity_prison',),
|
||||||
'landuse:quarry' => array('label'=>'Quarry','frequency'=>71,'icon'=>'',),
|
'landuse:quarry' => array('label'=>'Quarry','frequency'=>71,'icon'=>'',),
|
||||||
'amenity:telephone' => array('label'=>'Telephone','frequency'=>70,'icon'=>'',),
|
'amenity:telephone' => array('label'=>'Telephone','frequency'=>70,'icon'=>'',),
|
||||||
'highway:traffic_signals' => array('label'=>'Traffic Signals','frequency'=>66,'icon'=>'',),
|
'highway:traffic_signals' => array('label'=>'Traffic Signals','frequency'=>66,'icon'=>'',),
|
||||||
'natural:heath' => array('label'=>'Heath','frequency'=>62,'icon'=>'',),
|
'natural:heath' => array('label'=>'Heath','frequency'=>62,'icon'=>'',),
|
||||||
'historic:house' => array('label'=>'House','frequency'=>61,'icon'=>'',),
|
'historic:house' => array('label'=>'House','frequency'=>61,'icon'=>'',),
|
||||||
'amenity:social_club' => array('label'=>'Social Club','frequency'=>61,'icon'=>'',),
|
'amenity:social_club' => array('label'=>'Social Club','frequency'=>61,'icon'=>'',),
|
||||||
'landuse:military' => array('label'=>'Military','frequency'=>61,'icon'=>'',),
|
'landuse:military' => array('label'=>'Military','frequency'=>61,'icon'=>'',),
|
||||||
'amenity:health_centre' => array('label'=>'Health Centre','frequency'=>59,'icon'=>'',),
|
'amenity:health_centre' => array('label'=>'Health Centre','frequency'=>59,'icon'=>'',),
|
||||||
'historic:building' => array('label'=>'Building','frequency'=>58,'icon'=>'',),
|
'historic:building' => array('label'=>'Building','frequency'=>58,'icon'=>'',),
|
||||||
'amenity:clinic' => array('label'=>'Clinic','frequency'=>57,'icon'=>'',),
|
'amenity:clinic' => array('label'=>'Clinic','frequency'=>57,'icon'=>'',),
|
||||||
'highway:services' => array('label'=>'Services','frequency'=>56,'icon'=>'',),
|
'highway:services' => array('label'=>'Services','frequency'=>56,'icon'=>'',),
|
||||||
'amenity:ferry_terminal' => array('label'=>'Ferry Terminal','frequency'=>55,'icon'=>'',),
|
'amenity:ferry_terminal' => array('label'=>'Ferry Terminal','frequency'=>55,'icon'=>'',),
|
||||||
'natural:marsh' => array('label'=>'Marsh','frequency'=>55,'icon'=>'',),
|
'natural:marsh' => array('label'=>'Marsh','frequency'=>55,'icon'=>'',),
|
||||||
'natural:hill' => array('label'=>'Hill','frequency'=>54,'icon'=>'',),
|
'natural:hill' => array('label'=>'Hill','frequency'=>54,'icon'=>'',),
|
||||||
'highway:raceway' => array('label'=>'Raceway','frequency'=>53,'icon'=>'',),
|
'highway:raceway' => array('label'=>'Raceway','frequency'=>53,'icon'=>'',),
|
||||||
'amenity:taxi' => array('label'=>'Taxi','frequency'=>47,'icon'=>'',),
|
'amenity:taxi' => array('label'=>'Taxi','frequency'=>47,'icon'=>'',),
|
||||||
'amenity:take_away' => array('label'=>'Take Away','frequency'=>45,'icon'=>'',),
|
'amenity:take_away' => array('label'=>'Take Away','frequency'=>45,'icon'=>'',),
|
||||||
'amenity:car_rental' => array('label'=>'Car Rental','frequency'=>44,'icon'=>'',),
|
'amenity:car_rental' => array('label'=>'Car Rental','frequency'=>44,'icon'=>'',),
|
||||||
'place:islet' => array('label'=>'Islet','frequency'=>44,'icon'=>'',),
|
'place:islet' => array('label'=>'Islet','frequency'=>44,'icon'=>'',),
|
||||||
'amenity:nursery' => array('label'=>'Nursery','frequency'=>44,'icon'=>'',),
|
'amenity:nursery' => array('label'=>'Nursery','frequency'=>44,'icon'=>'',),
|
||||||
'amenity:nursing_home' => array('label'=>'Nursing Home','frequency'=>43,'icon'=>'',),
|
'amenity:nursing_home' => array('label'=>'Nursing Home','frequency'=>43,'icon'=>'',),
|
||||||
'amenity:toilets' => array('label'=>'Toilets','frequency'=>38,'icon'=>'',),
|
'amenity:toilets' => array('label'=>'Toilets','frequency'=>38,'icon'=>'',),
|
||||||
'amenity:hall' => array('label'=>'Hall','frequency'=>38,'icon'=>'',),
|
'amenity:hall' => array('label'=>'Hall','frequency'=>38,'icon'=>'',),
|
||||||
'waterway:boatyard' => array('label'=>'Boatyard','frequency'=>36,'icon'=>'',),
|
'waterway:boatyard' => array('label'=>'Boatyard','frequency'=>36,'icon'=>'',),
|
||||||
'highway:mini_roundabout' => array('label'=>'Mini Roundabout','frequency'=>35,'icon'=>'',),
|
'highway:mini_roundabout' => array('label'=>'Mini Roundabout','frequency'=>35,'icon'=>'',),
|
||||||
'historic:manor' => array('label'=>'Manor','frequency'=>35,'icon'=>'',),
|
'historic:manor' => array('label'=>'Manor','frequency'=>35,'icon'=>'',),
|
||||||
'tourism:chalet' => array('label'=>'Chalet','frequency'=>34,'icon'=>'',),
|
'tourism:chalet' => array('label'=>'Chalet','frequency'=>34,'icon'=>'',),
|
||||||
'amenity:bicycle_parking' => array('label'=>'Bicycle Parking','frequency'=>34,'icon'=>'',),
|
'amenity:bicycle_parking' => array('label'=>'Bicycle Parking','frequency'=>34,'icon'=>'',),
|
||||||
'amenity:hotel' => array('label'=>'Hotel','frequency'=>34,'icon'=>'',),
|
'amenity:hotel' => array('label'=>'Hotel','frequency'=>34,'icon'=>'',),
|
||||||
'waterway:weir' => array('label'=>'Weir','frequency'=>33,'icon'=>'',),
|
'waterway:weir' => array('label'=>'Weir','frequency'=>33,'icon'=>'',),
|
||||||
'natural:wetland' => array('label'=>'Wetland','frequency'=>33,'icon'=>'',),
|
'natural:wetland' => array('label'=>'Wetland','frequency'=>33,'icon'=>'',),
|
||||||
'natural:cave_entrance' => array('label'=>'Cave Entrance','frequency'=>32,'icon'=>'',),
|
'natural:cave_entrance' => array('label'=>'Cave Entrance','frequency'=>32,'icon'=>'',),
|
||||||
'amenity:crematorium' => array('label'=>'Crematorium','frequency'=>31,'icon'=>'',),
|
'amenity:crematorium' => array('label'=>'Crematorium','frequency'=>31,'icon'=>'',),
|
||||||
'tourism:picnic_site' => array('label'=>'Picnic Site','frequency'=>31,'icon'=>'',),
|
'tourism:picnic_site' => array('label'=>'Picnic Site','frequency'=>31,'icon'=>'',),
|
||||||
'landuse:wood' => array('label'=>'Wood','frequency'=>30,'icon'=>'',),
|
'landuse:wood' => array('label'=>'Wood','frequency'=>30,'icon'=>'',),
|
||||||
'landuse:basin' => array('label'=>'Basin','frequency'=>30,'icon'=>'',),
|
'landuse:basin' => array('label'=>'Basin','frequency'=>30,'icon'=>'',),
|
||||||
'natural:tree' => array('label'=>'Tree','frequency'=>30,'icon'=>'',),
|
'natural:tree' => array('label'=>'Tree','frequency'=>30,'icon'=>'',),
|
||||||
'leisure:slipway' => array('label'=>'Slipway','frequency'=>29,'icon'=>'',),
|
'leisure:slipway' => array('label'=>'Slipway','frequency'=>29,'icon'=>'',),
|
||||||
'landuse:meadow' => array('label'=>'Meadow','frequency'=>29,'icon'=>'',),
|
'landuse:meadow' => array('label'=>'Meadow','frequency'=>29,'icon'=>'',),
|
||||||
'landuse:piste' => array('label'=>'Piste','frequency'=>28,'icon'=>'',),
|
'landuse:piste' => array('label'=>'Piste','frequency'=>28,'icon'=>'',),
|
||||||
'amenity:care_home' => array('label'=>'Care Home','frequency'=>28,'icon'=>'',),
|
'amenity:care_home' => array('label'=>'Care Home','frequency'=>28,'icon'=>'',),
|
||||||
'amenity:club' => array('label'=>'Club','frequency'=>28,'icon'=>'',),
|
'amenity:club' => array('label'=>'Club','frequency'=>28,'icon'=>'',),
|
||||||
'amenity:medical_centre' => array('label'=>'Medical Centre','frequency'=>27,'icon'=>'',),
|
'amenity:medical_centre' => array('label'=>'Medical Centre','frequency'=>27,'icon'=>'',),
|
||||||
'historic:roman_road' => array('label'=>'Roman Road','frequency'=>27,'icon'=>'',),
|
'historic:roman_road' => array('label'=>'Roman Road','frequency'=>27,'icon'=>'',),
|
||||||
'historic:fort' => array('label'=>'Fort','frequency'=>26,'icon'=>'',),
|
'historic:fort' => array('label'=>'Fort','frequency'=>26,'icon'=>'',),
|
||||||
'railway:subway_entrance' => array('label'=>'Subway Entrance','frequency'=>26,'icon'=>'',),
|
'railway:subway_entrance' => array('label'=>'Subway Entrance','frequency'=>26,'icon'=>'',),
|
||||||
'historic:yes' => array('label'=>'Historic','frequency'=>25,'icon'=>'',),
|
'historic:yes' => array('label'=>'Historic','frequency'=>25,'icon'=>'',),
|
||||||
'highway:gate' => array('label'=>'Gate','frequency'=>25,'icon'=>'',),
|
'highway:gate' => array('label'=>'Gate','frequency'=>25,'icon'=>'',),
|
||||||
'leisure:fishing' => array('label'=>'Fishing','frequency'=>24,'icon'=>'',),
|
'leisure:fishing' => array('label'=>'Fishing','frequency'=>24,'icon'=>'',),
|
||||||
'historic:museum' => array('label'=>'Museum','frequency'=>24,'icon'=>'',),
|
'historic:museum' => array('label'=>'Museum','frequency'=>24,'icon'=>'',),
|
||||||
'amenity:car_wash' => array('label'=>'Car Wash','frequency'=>24,'icon'=>'',),
|
'amenity:car_wash' => array('label'=>'Car Wash','frequency'=>24,'icon'=>'',),
|
||||||
'railway:level_crossing' => array('label'=>'Level Crossing','frequency'=>23,'icon'=>'',),
|
'railway:level_crossing' => array('label'=>'Level Crossing','frequency'=>23,'icon'=>'',),
|
||||||
'leisure:bird_hide' => array('label'=>'Bird Hide','frequency'=>23,'icon'=>'',),
|
'leisure:bird_hide' => array('label'=>'Bird Hide','frequency'=>23,'icon'=>'',),
|
||||||
'natural:headland' => array('label'=>'Headland','frequency'=>21,'icon'=>'',),
|
'natural:headland' => array('label'=>'Headland','frequency'=>21,'icon'=>'',),
|
||||||
'tourism:apartments' => array('label'=>'Apartments','frequency'=>21,'icon'=>'',),
|
'tourism:apartments' => array('label'=>'Apartments','frequency'=>21,'icon'=>'',),
|
||||||
'amenity:shopping' => array('label'=>'Shopping','frequency'=>21,'icon'=>'',),
|
'amenity:shopping' => array('label'=>'Shopping','frequency'=>21,'icon'=>'',),
|
||||||
'natural:scrub' => array('label'=>'Scrub','frequency'=>20,'icon'=>'',),
|
'natural:scrub' => array('label'=>'Scrub','frequency'=>20,'icon'=>'',),
|
||||||
'natural:fen' => array('label'=>'Fen','frequency'=>20,'icon'=>'',),
|
'natural:fen' => array('label'=>'Fen','frequency'=>20,'icon'=>'',),
|
||||||
'building:yes' => array('label'=>'Building','frequency'=>200,'icon'=>'',),
|
'building:yes' => array('label'=>'Building','frequency'=>200,'icon'=>'',),
|
||||||
'mountain_pass:yes' => array('label'=>'Mountain Pass','frequency'=>200,'icon'=>'',),
|
'mountain_pass:yes' => array('label'=>'Mountain Pass','frequency'=>200,'icon'=>'',),
|
||||||
|
|
||||||
'amenity:parking' => array('label'=>'Parking','frequency'=>3157,'icon'=>'',),
|
'amenity:parking' => array('label'=>'Parking','frequency'=>3157,'icon'=>'',),
|
||||||
'highway:bus_stop' => array('label'=>'Bus Stop','frequency'=>35777,'icon'=>'transport_bus_stop2',),
|
'highway:bus_stop' => array('label'=>'Bus Stop','frequency'=>35777,'icon'=>'transport_bus_stop2',),
|
||||||
'place:postcode' => array('label'=>'Postcode','frequency'=>27267,'icon'=>'',),
|
'place:postcode' => array('label'=>'Postcode','frequency'=>27267,'icon'=>'',),
|
||||||
'amenity:post_box' => array('label'=>'Post Box','frequency'=>9613,'icon'=>'',),
|
'amenity:post_box' => array('label'=>'Post Box','frequency'=>9613,'icon'=>'',),
|
||||||
|
|
||||||
'place:houses' => array('label'=>'Houses','frequency'=>85,'icon'=>'',),
|
'place:houses' => array('label'=>'Houses','frequency'=>85,'icon'=>'',),
|
||||||
'railway:preserved' => array('label'=>'Preserved','frequency'=>227,'icon'=>'',),
|
'railway:preserved' => array('label'=>'Preserved','frequency'=>227,'icon'=>'',),
|
||||||
'waterway:derelict_canal' => array('label'=>'Derelict Canal','frequency'=>21,'icon'=>'',),
|
'waterway:derelict_canal' => array('label'=>'Derelict Canal','frequency'=>21,'icon'=>'',),
|
||||||
'amenity:dead_pub' => array('label'=>'Dead Pub','frequency'=>20,'icon'=>'',),
|
'amenity:dead_pub' => array('label'=>'Dead Pub','frequency'=>20,'icon'=>'',),
|
||||||
'railway:disused_station' => array('label'=>'Disused Station','frequency'=>114,'icon'=>'',),
|
'railway:disused_station' => array('label'=>'Disused Station','frequency'=>114,'icon'=>'',),
|
||||||
'railway:abandoned' => array('label'=>'Abandoned','frequency'=>641,'icon'=>'',),
|
'railway:abandoned' => array('label'=>'Abandoned','frequency'=>641,'icon'=>'',),
|
||||||
'railway:disused' => array('label'=>'Disused','frequency'=>72,'icon'=>'',),
|
'railway:disused' => array('label'=>'Disused','frequency'=>72,'icon'=>'',),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getClassTypesWithImportance()
|
function getClassTypesWithImportance()
|
||||||
{
|
{
|
||||||
$aOrders = getClassTypes();
|
$aOrders = getClassTypes();
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach($aOrders as $sID => $a)
|
foreach($aOrders as $sID => $a)
|
||||||
@@ -447,10 +447,10 @@
|
|||||||
$aOrders[$sID]['importance'] = $i++;
|
$aOrders[$sID]['importance'] = $i++;
|
||||||
}
|
}
|
||||||
return $aOrders;
|
return $aOrders;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getResultDiameter($aResult)
|
function getResultDiameter($aResult)
|
||||||
{
|
{
|
||||||
$aClassType = getClassTypes();
|
$aClassType = getClassTypes();
|
||||||
|
|
||||||
$fDiameter = 0.0001;
|
$fDiameter = 0.0001;
|
||||||
@@ -472,11 +472,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $fDiameter;
|
return $fDiameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function javascript_renderData($xVal, $iOptions = 0)
|
function javascript_renderData($xVal, $iOptions = 0)
|
||||||
{
|
{
|
||||||
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID > 50400)
|
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID > 50400)
|
||||||
$iOptions |= JSON_UNESCAPED_UNICODE;
|
$iOptions |= JSON_UNESCAPED_UNICODE;
|
||||||
$jsonout = json_encode($xVal, $iOptions);
|
$jsonout = json_encode($xVal, $iOptions);
|
||||||
@@ -497,11 +497,11 @@
|
|||||||
header('HTTP/1.0 400 Bad Request');
|
header('HTTP/1.0 400 Bad Request');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function _debugDumpGroupedSearches($aData, $aTokens)
|
function _debugDumpGroupedSearches($aData, $aTokens)
|
||||||
{
|
{
|
||||||
$aWordsIDs = array();
|
$aWordsIDs = array();
|
||||||
if ($aTokens)
|
if ($aTokens)
|
||||||
{
|
{
|
||||||
@@ -577,11 +577,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getAddressDetails(&$oDB, $sLanguagePrefArraySQL, $iPlaceID, $sCountryCode = false, $housenumber = -1, $bRaw = false)
|
function getAddressDetails(&$oDB, $sLanguagePrefArraySQL, $iPlaceID, $sCountryCode = false, $housenumber = -1, $bRaw = false)
|
||||||
{
|
{
|
||||||
$sSQL = "select *,get_name_by_language(name,$sLanguagePrefArraySQL) as localname from get_addressdata($iPlaceID, $housenumber)";
|
$sSQL = "select *,get_name_by_language(name,$sLanguagePrefArraySQL) as localname from get_addressdata($iPlaceID, $housenumber)";
|
||||||
if (!$bRaw) $sSQL .= " WHERE isaddress OR type = 'country_code'";
|
if (!$bRaw) $sSQL .= " WHERE isaddress OR type = 'country_code'";
|
||||||
$sSQL .= " order by rank_address desc,isaddress desc";
|
$sSQL .= " order by rank_address desc,isaddress desc";
|
||||||
@@ -621,25 +621,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $aAddress;
|
return $aAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function addQuotes($s)
|
function addQuotes($s)
|
||||||
{
|
{
|
||||||
return "'".$s."'";
|
return "'".$s."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns boolean
|
// returns boolean
|
||||||
function validLatLon($fLat,$fLon)
|
function validLatLon($fLat,$fLon)
|
||||||
{
|
{
|
||||||
return ($fLat <= 90.1 && $fLat >= -90.1 && $fLon <= 180.1 && $fLon >= -180.1);
|
return ($fLat <= 90.1 && $fLat >= -90.1 && $fLon <= 180.1 && $fLon >= -180.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we have anything that looks like a lat/lon pair?
|
// Do we have anything that looks like a lat/lon pair?
|
||||||
// returns array(lat,lon,query_with_lat_lon_removed)
|
// returns array(lat,lon,query_with_lat_lon_removed)
|
||||||
// or null
|
// or null
|
||||||
function looksLikeLatLonPair($sQuery)
|
function looksLikeLatLonPair($sQuery)
|
||||||
{
|
{
|
||||||
$sFound = null;
|
$sFound = null;
|
||||||
$fQueryLat = null;
|
$fQueryLat = null;
|
||||||
$fQueryLon = null;
|
$fQueryLon = null;
|
||||||
@@ -717,11 +717,11 @@
|
|||||||
$sQuery = trim(str_replace($sFound, ' ', $sQuery));
|
$sQuery = trim(str_replace($sFound, ' ', $sQuery));
|
||||||
|
|
||||||
return array('lat' => $fQueryLat, 'lon' => $fQueryLon, 'query' => $sQuery);
|
return array('lat' => $fQueryLat, 'lon' => $fQueryLon, 'query' => $sQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function geometryText2Points($geometry_as_text, $fRadius)
|
function geometryText2Points($geometry_as_text, $fRadius)
|
||||||
{
|
{
|
||||||
$aPolyPoints = NULL;
|
$aPolyPoints = NULL;
|
||||||
if (preg_match('#POLYGON\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch))
|
if (preg_match('#POLYGON\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch))
|
||||||
{
|
{
|
||||||
@@ -751,10 +751,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPointsAroundCenter($fLon, $fLat, $fRadius)
|
function createPointsAroundCenter($fLon, $fLat, $fRadius)
|
||||||
{
|
{
|
||||||
$iSteps = max(8, min(100, ($fRadius * 40000)^2));
|
$iSteps = max(8, min(100, ($fRadius * 40000)^2));
|
||||||
$fStepSize = (2*pi())/$iSteps;
|
$fStepSize = (2*pi())/$iSteps;
|
||||||
$aPolyPoints = array();
|
$aPolyPoints = array();
|
||||||
@@ -763,4 +763,4 @@
|
|||||||
$aPolyPoints[] = array('', $fLon+($fRadius*sin($f)), $fLat+($fRadius*cos($f)) );
|
$aPolyPoints[] = array('', $fLon+($fRadius*sin($f)), $fLat+($fRadius*cos($f)) );
|
||||||
}
|
}
|
||||||
return $aPolyPoints;
|
return $aPolyPoints;
|
||||||
}
|
}
|
||||||
|
|||||||
12
lib/log.php
12
lib/log.php
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function logStart(&$oDB, $sType = '', $sQuery = '', $aLanguageList = array())
|
function logStart(&$oDB, $sType = '', $sQuery = '', $aLanguageList = array())
|
||||||
{
|
{
|
||||||
$fStartTime = microtime(true);
|
$fStartTime = microtime(true);
|
||||||
$aStartTime = explode('.', $fStartTime);
|
$aStartTime = explode('.', $fStartTime);
|
||||||
if (!isset($aStartTime[1])) $aStartTime[1] = '0';
|
if (!isset($aStartTime[1])) $aStartTime[1] = '0';
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $hLog;
|
return $hLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
function logEnd(&$oDB, $hLog, $iNumResults)
|
function logEnd(&$oDB, $hLog, $iNumResults)
|
||||||
{
|
{
|
||||||
$fEndTime = microtime(true);
|
$fEndTime = microtime(true);
|
||||||
|
|
||||||
if (CONST_Log_DB)
|
if (CONST_Log_DB)
|
||||||
@@ -71,4 +71,4 @@
|
|||||||
file_put_contents(CONST_Log_File, $aOutdata, FILE_APPEND | LOCK_EX);
|
file_put_contents(CONST_Log_File, $aOutdata, FILE_APPEND | LOCK_EX);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function formatOSMType($sType, $bIncludeExternal=true)
|
function formatOSMType($sType, $bIncludeExternal=true)
|
||||||
{
|
{
|
||||||
if ($sType == 'N') return 'node';
|
if ($sType == 'N') return 'node';
|
||||||
if ($sType == 'W') return 'way';
|
if ($sType == 'W') return 'way';
|
||||||
if ($sType == 'R') return 'relation';
|
if ($sType == 'R') return 'relation';
|
||||||
@@ -12,32 +12,32 @@
|
|||||||
if ($sType == 'I') return 'way';
|
if ($sType == 'I') return 'way';
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function osmLink($aFeature, $sRefText=false)
|
function osmLink($aFeature, $sRefText=false)
|
||||||
{
|
{
|
||||||
$sOSMType = formatOSMType($aFeature['osm_type'], false);
|
$sOSMType = formatOSMType($aFeature['osm_type'], false);
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
return '<a href="//www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'</a>';
|
return '<a href="//www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'</a>';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function wikipediaLink($aFeature)
|
function wikipediaLink($aFeature)
|
||||||
{
|
{
|
||||||
if ($aFeature['wikipedia'])
|
if ($aFeature['wikipedia'])
|
||||||
{
|
{
|
||||||
list($sLanguage, $sArticle) = explode(':',$aFeature['wikipedia']);
|
list($sLanguage, $sArticle) = explode(':',$aFeature['wikipedia']);
|
||||||
return '<a href="https://'.$sLanguage.'.wikipedia.org/wiki/'.urlencode($sArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
|
return '<a href="https://'.$sLanguage.'.wikipedia.org/wiki/'.urlencode($sArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function detailsLink($aFeature, $sTitle=false)
|
function detailsLink($aFeature, $sTitle=false)
|
||||||
{
|
{
|
||||||
if (!$aFeature['place_id']) return '';
|
if (!$aFeature['place_id']) return '';
|
||||||
|
|
||||||
return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
|
return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
$aFilteredPlaces = array();
|
|
||||||
|
|
||||||
if (!sizeof($aPlace))
|
$aFilteredPlaces = array();
|
||||||
{
|
|
||||||
|
if (!sizeof($aPlace))
|
||||||
|
{
|
||||||
if (isset($sError))
|
if (isset($sError))
|
||||||
$aFilteredPlaces['error'] = $sError;
|
$aFilteredPlaces['error'] = $sError;
|
||||||
else
|
else
|
||||||
$aFilteredPlaces['error'] = 'Unable to geocode';
|
$aFilteredPlaces['error'] = 'Unable to geocode';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
||||||
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
||||||
$sOSMType = formatOSMType($aPlace['osm_type']);
|
$sOSMType = formatOSMType($aPlace['osm_type']);
|
||||||
@@ -49,7 +50,7 @@
|
|||||||
{
|
{
|
||||||
$aFilteredPlaces['geokml'] = $aPlace['askml'];
|
$aFilteredPlaces['geokml'] = $aPlace['askml'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
javascript_renderData($aFilteredPlaces);
|
javascript_renderData($aFilteredPlaces);
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
$aFilteredPlaces = array();
|
|
||||||
|
|
||||||
if (!sizeof($aPlace))
|
$aFilteredPlaces = array();
|
||||||
{
|
|
||||||
|
if (!sizeof($aPlace))
|
||||||
|
{
|
||||||
if (isset($sError))
|
if (isset($sError))
|
||||||
$aFilteredPlaces['error'] = $sError;
|
$aFilteredPlaces['error'] = $sError;
|
||||||
else
|
else
|
||||||
$aFilteredPlaces['error'] = 'Unable to geocode';
|
$aFilteredPlaces['error'] = 'Unable to geocode';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
||||||
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
||||||
$sOSMType = formatOSMType($aPlace['osm_type']);
|
$sOSMType = formatOSMType($aPlace['osm_type']);
|
||||||
@@ -62,6 +63,6 @@
|
|||||||
$aFilteredPlaces['geokml'] = $aPlace['askml'];
|
$aFilteredPlaces['geokml'] = $aPlace['askml'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
javascript_renderData($aFilteredPlaces);
|
javascript_renderData($aFilteredPlaces);
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
header("content-type: text/xml; charset=UTF-8");
|
header("content-type: text/xml; charset=UTF-8");
|
||||||
|
|
||||||
echo "<";
|
echo "<";
|
||||||
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
echo "<reversegeocode";
|
echo "<reversegeocode";
|
||||||
echo " timestamp='".date(DATE_RFC822)."'";
|
echo " timestamp='".date(DATE_RFC822)."'";
|
||||||
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
|
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
|
||||||
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
|
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
if (!sizeof($aPlace))
|
if (!sizeof($aPlace))
|
||||||
{
|
{
|
||||||
if (isset($sError))
|
if (isset($sError))
|
||||||
echo "<error>$sError</error>";
|
echo "<error>$sError</error>";
|
||||||
else
|
else
|
||||||
echo "<error>Unable to geocode</error>";
|
echo "<error>Unable to geocode</error>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<result";
|
echo "<result";
|
||||||
if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
|
if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
|
||||||
$sOSMType = formatOSMType($aPlace['osm_type']);
|
$sOSMType = formatOSMType($aPlace['osm_type']);
|
||||||
@@ -98,6 +98,6 @@
|
|||||||
echo "</geokml>";
|
echo "</geokml>";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</reversegeocode>";
|
echo "</reversegeocode>";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<header class="container-fluid">
|
<header class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-4">
|
<div class="col-xs-4">
|
||||||
<div class="brand">
|
<div class="brand">
|
||||||
@@ -29,9 +29,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="modal fade" id="report-modal">
|
<div class="modal fade" id="report-modal">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -46,4 +46,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$aOutput = array();
|
$aOutput = array();
|
||||||
$aOutput['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
$aOutput['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
||||||
$aOutput['batch'] = array();
|
$aOutput['batch'] = array();
|
||||||
|
|
||||||
foreach($aBatchResults as $aSearchResults)
|
foreach($aBatchResults as $aSearchResults)
|
||||||
{
|
{
|
||||||
if (!$aSearchResults) $aSearchResults = array();
|
if (!$aSearchResults) $aSearchResults = array();
|
||||||
$aFilteredPlaces = array();
|
$aFilteredPlaces = array();
|
||||||
foreach($aSearchResults as $iResNum => $aPointDetails)
|
foreach($aSearchResults as $iResNum => $aPointDetails)
|
||||||
@@ -83,6 +83,6 @@
|
|||||||
$aFilteredPlaces[] = $aPlace;
|
$aFilteredPlaces[] = $aPlace;
|
||||||
}
|
}
|
||||||
$aOutput['batch'][] = $aFilteredPlaces;
|
$aOutput['batch'][] = $aFilteredPlaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
javascript_renderData($aOutput, array('geojson'));
|
javascript_renderData($aOutput, array('geojson'));
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
header("content-type: application/json; charset=UTF-8");
|
header("content-type: application/json; charset=UTF-8");
|
||||||
|
|
||||||
$aFilteredPlaces = array();
|
$aFilteredPlaces = array();
|
||||||
foreach($aSearchResults as $iResNum => $aPointDetails)
|
foreach($aSearchResults as $iResNum => $aPointDetails)
|
||||||
{
|
{
|
||||||
$aPlace = array(
|
$aPlace = array(
|
||||||
'place_id'=>$aPointDetails['place_id'],
|
'place_id'=>$aPointDetails['place_id'],
|
||||||
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
||||||
@@ -74,6 +74,6 @@
|
|||||||
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
|
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
|
||||||
|
|
||||||
$aFilteredPlaces[] = $aPlace;
|
$aFilteredPlaces[] = $aPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
javascript_renderData($aFilteredPlaces);
|
javascript_renderData($aFilteredPlaces);
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
$aFilteredPlaces = array();
|
|
||||||
foreach($aSearchResults as $iResNum => $aPointDetails)
|
$aFilteredPlaces = array();
|
||||||
{
|
foreach($aSearchResults as $iResNum => $aPointDetails)
|
||||||
|
{
|
||||||
$aPlace = array(
|
$aPlace = array(
|
||||||
'place_id'=>$aPointDetails['place_id'],
|
'place_id'=>$aPointDetails['place_id'],
|
||||||
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
||||||
@@ -73,6 +74,6 @@
|
|||||||
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
|
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
|
||||||
|
|
||||||
$aFilteredPlaces[] = $aPlace;
|
$aFilteredPlaces[] = $aPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
javascript_renderData($aFilteredPlaces);
|
javascript_renderData($aFilteredPlaces);
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
header("content-type: text/xml; charset=UTF-8");
|
header("content-type: text/xml; charset=UTF-8");
|
||||||
|
|
||||||
echo "<";
|
echo "<";
|
||||||
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
echo "<";
|
echo "<";
|
||||||
echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults');
|
echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults');
|
||||||
echo " timestamp='".date(DATE_RFC822)."'";
|
echo " timestamp='".date(DATE_RFC822)."'";
|
||||||
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
|
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
|
||||||
echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
|
echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
|
||||||
if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
|
if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
|
||||||
echo " polygon='".($bShowPolygons?'true':'false')."'";
|
echo " polygon='".($bShowPolygons?'true':'false')."'";
|
||||||
if (sizeof($aExcludePlaceIDs))
|
if (sizeof($aExcludePlaceIDs))
|
||||||
{
|
{
|
||||||
echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
|
echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
|
||||||
}
|
}
|
||||||
if ($sMoreURL)
|
if ($sMoreURL)
|
||||||
{
|
{
|
||||||
echo " more_url='".htmlspecialchars($sMoreURL)."'";
|
echo " more_url='".htmlspecialchars($sMoreURL)."'";
|
||||||
}
|
}
|
||||||
echo ">\n";
|
echo ">\n";
|
||||||
|
|
||||||
foreach($aSearchResults as $iResNum => $aResult)
|
foreach($aSearchResults as $iResNum => $aResult)
|
||||||
{
|
{
|
||||||
echo "<place place_id='".$aResult['place_id']."'";
|
echo "<place place_id='".$aResult['place_id']."'";
|
||||||
$sOSMType = formatOSMType($aResult['osm_type']);
|
$sOSMType = formatOSMType($aResult['osm_type']);
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
@@ -156,6 +156,6 @@
|
|||||||
{
|
{
|
||||||
echo "/>";
|
echo "/>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</" . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . ">";
|
echo "</" . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . ">";
|
||||||
|
|||||||
@@ -1,105 +1,104 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_BasePath', '@CMAKE_SOURCE_DIR@');
|
@define('CONST_BasePath', '@CMAKE_SOURCE_DIR@');
|
||||||
@define('CONST_InstallPath', '@CMAKE_BINARY_DIR@');
|
@define('CONST_InstallPath', '@CMAKE_BINARY_DIR@');
|
||||||
if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SETTINGS'));
|
if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SETTINGS'));
|
||||||
if (file_exists(CONST_InstallPath.'/settings/local.php')) require_once(CONST_InstallPath.'/settings/local.php');
|
if (file_exists(CONST_InstallPath.'/settings/local.php')) require_once(CONST_InstallPath.'/settings/local.php');
|
||||||
if (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true);
|
if (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true);
|
||||||
|
|
||||||
// General settings
|
// General settings
|
||||||
@define('CONST_Debug', false);
|
@define('CONST_Debug', false);
|
||||||
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
|
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
|
||||||
@define('CONST_Database_Web_User', 'www-data');
|
@define('CONST_Database_Web_User', 'www-data');
|
||||||
@define('CONST_Max_Word_Frequency', '50000');
|
@define('CONST_Max_Word_Frequency', '50000');
|
||||||
@define('CONST_Limit_Reindexing', true);
|
@define('CONST_Limit_Reindexing', true);
|
||||||
// Set to false to avoid importing extra postcodes for the US.
|
// Set to false to avoid importing extra postcodes for the US.
|
||||||
@define('CONST_Use_Extra_US_Postcodes', true);
|
@define('CONST_Use_Extra_US_Postcodes', true);
|
||||||
// Set to true after importing Tiger house number data for the US.
|
// Set to true after importing Tiger house number data for the US.
|
||||||
// Note: The tables must already exist or queries will throw errors.
|
// Note: The tables must already exist or queries will throw errors.
|
||||||
// After changing this setting run ./utils/setup --create-functions
|
// After changing this setting run ./utils/setup --create-functions
|
||||||
// again.
|
// again.
|
||||||
@define('CONST_Use_US_Tiger_Data', false);
|
@define('CONST_Use_US_Tiger_Data', false);
|
||||||
// Set to true after importing other external house number data.
|
// Set to true after importing other external house number data.
|
||||||
// Note: the aux tables must already exist or queries will throw errors.
|
// Note: the aux tables must already exist or queries will throw errors.
|
||||||
// After changing this setting run ./utils/setup --create-functions
|
// After changing this setting run ./utils/setup --create-functions
|
||||||
// again.
|
// again.
|
||||||
@define('CONST_Use_Aux_Location_data', false);
|
@define('CONST_Use_Aux_Location_data', false);
|
||||||
|
|
||||||
// Proxy settings
|
// Proxy settings
|
||||||
@define('CONST_HTTP_Proxy', false);
|
@define('CONST_HTTP_Proxy', false);
|
||||||
@define('CONST_HTTP_Proxy_Host', 'proxy.mydomain.com');
|
@define('CONST_HTTP_Proxy_Host', 'proxy.mydomain.com');
|
||||||
@define('CONST_HTTP_Proxy_Port', '3128');
|
@define('CONST_HTTP_Proxy_Port', '3128');
|
||||||
@define('CONST_HTTP_Proxy_Login', '');
|
@define('CONST_HTTP_Proxy_Login', '');
|
||||||
@define('CONST_HTTP_Proxy_Password', '');
|
@define('CONST_HTTP_Proxy_Password', '');
|
||||||
|
|
||||||
// Paths
|
// Paths
|
||||||
@define('CONST_Osm2pgsql_Binary', CONST_InstallPath.'/osm2pgsql/osm2pgsql');
|
@define('CONST_Osm2pgsql_Binary', CONST_InstallPath.'/osm2pgsql/osm2pgsql');
|
||||||
@define('CONST_Osmosis_Binary', '/usr/bin/osmosis');
|
@define('CONST_Osmosis_Binary', '/usr/bin/osmosis');
|
||||||
@define('CONST_Tiger_Data_Path', CONST_BasePath.'/data/tiger');
|
@define('CONST_Tiger_Data_Path', CONST_BasePath.'/data/tiger');
|
||||||
|
|
||||||
// osm2pgsql settings
|
// osm2pgsql settings
|
||||||
@define('CONST_Osm2pgsql_Flatnode_File', null);
|
@define('CONST_Osm2pgsql_Flatnode_File', null);
|
||||||
|
|
||||||
// tablespace settings
|
// tablespace settings
|
||||||
// osm2pgsql caching tables (aka slim mode tables) - update only
|
// osm2pgsql caching tables (aka slim mode tables) - update only
|
||||||
@define('CONST_Tablespace_Osm2pgsql_Data', false);
|
@define('CONST_Tablespace_Osm2pgsql_Data', false);
|
||||||
@define('CONST_Tablespace_Osm2pgsql_Index', false);
|
@define('CONST_Tablespace_Osm2pgsql_Index', false);
|
||||||
// osm2pgsql output tables (aka main table) - update only
|
// osm2pgsql output tables (aka main table) - update only
|
||||||
@define('CONST_Tablespace_Place_Data', false);
|
@define('CONST_Tablespace_Place_Data', false);
|
||||||
@define('CONST_Tablespace_Place_Index', false);
|
@define('CONST_Tablespace_Place_Index', false);
|
||||||
// address computation tables - update only
|
// address computation tables - update only
|
||||||
@define('CONST_Tablespace_Address_Data', false);
|
@define('CONST_Tablespace_Address_Data', false);
|
||||||
@define('CONST_Tablespace_Address_Index', false);
|
@define('CONST_Tablespace_Address_Index', false);
|
||||||
// search tables - needed for lookups
|
// search tables - needed for lookups
|
||||||
@define('CONST_Tablespace_Search_Data', false);
|
@define('CONST_Tablespace_Search_Data', false);
|
||||||
@define('CONST_Tablespace_Search_Index', false);
|
@define('CONST_Tablespace_Search_Index', false);
|
||||||
// additional data, e.g. TIGER data, type searches - needed for lookups
|
// additional data, e.g. TIGER data, type searches - needed for lookups
|
||||||
@define('CONST_Tablespace_Aux_Data', false);
|
@define('CONST_Tablespace_Aux_Data', false);
|
||||||
@define('CONST_Tablespace_Aux_Index', false);
|
@define('CONST_Tablespace_Aux_Index', false);
|
||||||
|
|
||||||
// Replication settings
|
// Replication settings
|
||||||
@define('CONST_Replication_Url', 'http://planet.openstreetmap.org/replication/minute');
|
@define('CONST_Replication_Url', 'http://planet.openstreetmap.org/replication/minute');
|
||||||
@define('CONST_Replication_MaxInterval', '3600');
|
@define('CONST_Replication_MaxInterval', '3600');
|
||||||
@define('CONST_Replication_Update_Interval', '60'); // How often upstream publishes diffs
|
@define('CONST_Replication_Update_Interval', '60'); // How often upstream publishes diffs
|
||||||
@define('CONST_Replication_Recheck_Interval', '60'); // How long to sleep if no update found yet
|
@define('CONST_Replication_Recheck_Interval', '60'); // How long to sleep if no update found yet
|
||||||
|
|
||||||
// Website settings
|
// Website settings
|
||||||
@define('CONST_NoAccessControl', true);
|
@define('CONST_NoAccessControl', true);
|
||||||
|
|
||||||
@define('CONST_Website_BaseURL', 'http://'.php_uname('n').'/');
|
@define('CONST_Website_BaseURL', 'http://'.php_uname('n').'/');
|
||||||
// Language to assume when none is supplied with the query.
|
// Language to assume when none is supplied with the query.
|
||||||
// When set to false, the local language (i.e. the name tag without suffix)
|
// When set to false, the local language (i.e. the name tag without suffix)
|
||||||
// will be used.
|
// will be used.
|
||||||
@define('CONST_Default_Language', false);
|
@define('CONST_Default_Language', false);
|
||||||
// Appearance of the map in the debug interface.
|
// Appearance of the map in the debug interface.
|
||||||
@define('CONST_Default_Lat', 20.0);
|
@define('CONST_Default_Lat', 20.0);
|
||||||
@define('CONST_Default_Lon', 0.0);
|
@define('CONST_Default_Lon', 0.0);
|
||||||
@define('CONST_Default_Zoom', 2);
|
@define('CONST_Default_Zoom', 2);
|
||||||
@define('CONST_Map_Tile_URL', 'http://{s}.tile.osm.org/{z}/{x}/{y}.png');
|
@define('CONST_Map_Tile_URL', 'http://{s}.tile.osm.org/{z}/{x}/{y}.png');
|
||||||
@define('CONST_Map_Tile_Attribution', ''); // Set if tile source isn't osm.org
|
@define('CONST_Map_Tile_Attribution', ''); // Set if tile source isn't osm.org
|
||||||
|
|
||||||
@define('CONST_Search_AreaPolygons', true);
|
@define('CONST_Search_AreaPolygons', true);
|
||||||
|
|
||||||
@define('CONST_Search_BatchMode', false);
|
@define('CONST_Search_BatchMode', false);
|
||||||
|
|
||||||
@define('CONST_Search_TryDroppedAddressTerms', false);
|
@define('CONST_Search_TryDroppedAddressTerms', false);
|
||||||
@define('CONST_Search_NameOnlySearchFrequencyThreshold', 500);
|
@define('CONST_Search_NameOnlySearchFrequencyThreshold', 500);
|
||||||
// If set to true, then reverse order of queries will be tried by default.
|
// If set to true, then reverse order of queries will be tried by default.
|
||||||
// When set to false only selected languages alloow reverse search.
|
// When set to false only selected languages alloow reverse search.
|
||||||
@define('CONST_Search_ReversePlanForAll', true);
|
@define('CONST_Search_ReversePlanForAll', true);
|
||||||
|
|
||||||
// Maximum number of OSM ids that may be queried at once
|
// Maximum number of OSM ids that may be queried at once
|
||||||
// for the places endpoint.
|
// for the places endpoint.
|
||||||
@define('CONST_Places_Max_ID_count', 50);
|
@define('CONST_Places_Max_ID_count', 50);
|
||||||
|
|
||||||
// Number of different geometry formats that may be queried in parallel.
|
// Number of different geometry formats that may be queried in parallel.
|
||||||
// Set to zero to disable polygon output.
|
// Set to zero to disable polygon output.
|
||||||
@define('CONST_PolygonOutput_MaximumTypes', 1);
|
@define('CONST_PolygonOutput_MaximumTypes', 1);
|
||||||
|
|
||||||
// Log settings
|
|
||||||
// Set to true to log into new_query_log table.
|
|
||||||
// You should set up a cron job that regularly clears out this table.
|
|
||||||
@define('CONST_Log_DB', false);
|
|
||||||
// Set to a file name to enable logging to a file.
|
|
||||||
@define('CONST_Log_File', false);
|
|
||||||
|
|
||||||
|
// Log settings
|
||||||
|
// Set to true to log into new_query_log table.
|
||||||
|
// You should set up a cron job that regularly clears out this table.
|
||||||
|
@define('CONST_Log_DB', false);
|
||||||
|
// Set to a file name to enable logging to a file.
|
||||||
|
@define('CONST_Log_File', false);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
echo "ERROR: Scripts must be run from build directory.\n";
|
|
||||||
exit;
|
echo "ERROR: Scripts must be run from build directory.\n";
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Manage service blocks / restrictions",
|
"Manage service blocks / restrictions",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
||||||
@@ -13,18 +13,18 @@
|
|||||||
array('list', 'l', 0, 1, 0, 0, 'bool', 'List recent blocks'),
|
array('list', 'l', 0, 1, 0, 0, 'bool', 'List recent blocks'),
|
||||||
array('delete', 'd', 0, 1, 0, 0, 'bool', 'Clear recent blocks list'),
|
array('delete', 'd', 0, 1, 0, 0, 'bool', 'Clear recent blocks list'),
|
||||||
array('flush', '', 0, 1, 0, 0, 'bool', 'Flush all blocks / stats'),
|
array('flush', '', 0, 1, 0, 0, 'bool', 'Flush all blocks / stats'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
||||||
|
|
||||||
$m = getBucketMemcache();
|
$m = getBucketMemcache();
|
||||||
if (!$m)
|
if (!$m)
|
||||||
{
|
{
|
||||||
echo "ERROR: Bucket memcache is not configured\n";
|
echo "ERROR: Bucket memcache is not configured\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['list'])
|
if ($aResult['list'])
|
||||||
{
|
{
|
||||||
$iCurrentSleeping = $m->get('sleepCounter');
|
$iCurrentSleeping = $m->get('sleepCounter');
|
||||||
echo "\n Sleeping blocks count: $iCurrentSleeping\n";
|
echo "\n Sleeping blocks count: $iCurrentSleeping\n";
|
||||||
|
|
||||||
@@ -39,15 +39,15 @@
|
|||||||
date("r", $aDetails['lastBlockTimestamp']), $aDetails['isSleeping']?'Y':'N');
|
date("r", $aDetails['lastBlockTimestamp']), $aDetails['isSleeping']?'Y':'N');
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['delete'])
|
if ($aResult['delete'])
|
||||||
{
|
{
|
||||||
$m->set('sleepCounter', 0);
|
$m->set('sleepCounter', 0);
|
||||||
clearBucketBlocks();
|
clearBucketBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['flush'])
|
if ($aResult['flush'])
|
||||||
{
|
{
|
||||||
$m->flush();
|
$m->flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
|
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
ini_set('display_errors', 'stderr');
|
ini_set('display_errors', 'stderr');
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
include(CONST_InstallPath.'/settings/phrase_settings.php');
|
include(CONST_InstallPath.'/settings/phrase_settings.php');
|
||||||
|
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
$sURL = 'http://wiki.openstreetmap.org/wiki/Special:Export/Nominatim/Country_Codes';
|
$sURL = 'http://wiki.openstreetmap.org/wiki/Special:Export/Nominatim/Country_Codes';
|
||||||
$sWikiPageXML = file_get_contents($sURL);
|
$sWikiPageXML = file_get_contents($sURL);
|
||||||
if (preg_match_all('#\\| ([a-z]{2}) \\|\\| [^|]+\\|\\| ([a-z,]+)#', $sWikiPageXML, $aMatches, PREG_SET_ORDER))
|
if (preg_match_all('#\\| ([a-z]{2}) \\|\\| [^|]+\\|\\| ([a-z,]+)#', $sWikiPageXML, $aMatches, PREG_SET_ORDER))
|
||||||
@@ -33,4 +33,4 @@
|
|||||||
echo "UPDATE country_name set country_default_language_codes = '{".join(',',$aLanguages)."}' where country_code = '".pg_escape_string($aMatch[1])."';\n";
|
echo "UPDATE country_name set country_default_language_codes = '{".join(',',$aLanguages)."}' where country_code = '".pg_escape_string($aMatch[1])."';\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Create and setup nominatim search system",
|
"Create and setup nominatim search system",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
array('create-tables', '', 0, 1, 0, 0, 'bool', 'Create wikipedia tables'),
|
array('create-tables', '', 0, 1, 0, 0, 'bool', 'Create wikipedia tables'),
|
||||||
array('parse-articles', '', 0, 1, 0, 0, 'bool', 'Parse wikipedia articles'),
|
array('parse-articles', '', 0, 1, 0, 0, 'bool', 'Parse wikipedia articles'),
|
||||||
array('link', '', 0, 1, 0, 0, 'bool', 'Try to link to existing OSM ids'),
|
array('link', '', 0, 1, 0, 0, 'bool', 'Try to link to existing OSM ids'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$sTestPageText = <<<EOD
|
$sTestPageText = <<<EOD
|
||||||
@@ -58,8 +58,8 @@ exit;
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($aCMDResult['create-tables'])
|
if ($aCMDResult['create-tables'])
|
||||||
{
|
{
|
||||||
$sSQL = <<<'EOD'
|
$sSQL = <<<'EOD'
|
||||||
CREATE TABLE wikipedia_article (
|
CREATE TABLE wikipedia_article (
|
||||||
language text NOT NULL,
|
language text NOT NULL,
|
||||||
@@ -88,16 +88,16 @@ CREATE TABLE wikipedia_link (
|
|||||||
);
|
);
|
||||||
EOD;
|
EOD;
|
||||||
$oDB->query($sSQL);
|
$oDB->query($sSQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
function degreesAndMinutesToDecimal($iDegrees, $iMinutes=0, $fSeconds=0, $sNSEW='N')
|
function degreesAndMinutesToDecimal($iDegrees, $iMinutes=0, $fSeconds=0, $sNSEW='N')
|
||||||
{
|
{
|
||||||
$sNSEW = strtoupper($sNSEW);
|
$sNSEW = strtoupper($sNSEW);
|
||||||
return ($sNSEW == 'S' || $sNSEW == 'W'?-1:1) * ((float)$iDegrees + (float)$iMinutes/60 + (float)$fSeconds/3600);
|
return ($sNSEW == 'S' || $sNSEW == 'W'?-1:1) * ((float)$iDegrees + (float)$iMinutes/60 + (float)$fSeconds/3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseWikipediaContent($sPageText)
|
function _parseWikipediaContent($sPageText)
|
||||||
{
|
{
|
||||||
$sPageText = str_replace("\n", ' ', $sPageText);
|
$sPageText = str_replace("\n", ' ', $sPageText);
|
||||||
$sPageText = preg_replace('#<!--.*?-->#m', '', $sPageText);
|
$sPageText = preg_replace('#<!--.*?-->#m', '', $sPageText);
|
||||||
$sPageText = preg_replace('#<math>.*?<\\/math>#m', '', $sPageText);
|
$sPageText = preg_replace('#<math>.*?<\\/math>#m', '', $sPageText);
|
||||||
@@ -201,10 +201,10 @@ EOD;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $aTemplates;
|
return $aTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _templatesToProperties($aTemplates)
|
function _templatesToProperties($aTemplates)
|
||||||
{
|
{
|
||||||
$aPageProperties = array();
|
$aPageProperties = array();
|
||||||
foreach($aTemplates as $iTemplate => $aTemplate)
|
foreach($aTemplates as $iTemplate => $aTemplate)
|
||||||
{
|
{
|
||||||
@@ -345,10 +345,10 @@ EOD;
|
|||||||
unset($aPageProperties['sPossibleInfoboxType']);
|
unset($aPageProperties['sPossibleInfoboxType']);
|
||||||
}
|
}
|
||||||
return $aPageProperties;
|
return $aPageProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aCMDResult['parse-wikipedia']))
|
if (isset($aCMDResult['parse-wikipedia']))
|
||||||
{
|
{
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
$aArticleNames = $oDB->getCol('select page_title from content where page_namespace = 0 and page_id %10 = '.$aCMDResult['parse-wikipedia'].' and (page_content ilike \'%{{Coord%\' or (page_content ilike \'%lat%\' and page_content ilike \'%lon%\'))');
|
$aArticleNames = $oDB->getCol('select page_title from content where page_namespace = 0 and page_id %10 = '.$aCMDResult['parse-wikipedia'].' and (page_content ilike \'%{{Coord%\' or (page_content ilike \'%lat%\' and page_content ilike \'%lon%\'))');
|
||||||
// $aArticleNames = $oDB->getCol($sSQL = 'select page_title from content where page_namespace = 0 and (page_content ilike \'%{{Coord%\' or (page_content ilike \'%lat%\' and page_content ilike \'%lon%\')) and page_title in (\'Virginia\')');
|
// $aArticleNames = $oDB->getCol($sSQL = 'select page_title from content where page_namespace = 0 and (page_content ilike \'%{{Coord%\' or (page_content ilike \'%lat%\' and page_content ilike \'%lon%\')) and page_title in (\'Virginia\')');
|
||||||
@@ -390,10 +390,10 @@ EOD;
|
|||||||
$oDB->query($sSQL);
|
$oDB->query($sSQL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nominatimXMLStart($hParser, $sName, $aAttr)
|
function nominatimXMLStart($hParser, $sName, $aAttr)
|
||||||
{
|
{
|
||||||
global $aNominatRecords;
|
global $aNominatRecords;
|
||||||
switch($sName)
|
switch($sName)
|
||||||
{
|
{
|
||||||
@@ -401,15 +401,15 @@ EOD;
|
|||||||
$aNominatRecords[] = $aAttr;
|
$aNominatRecords[] = $aAttr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nominatimXMLEnd($hParser, $sName)
|
function nominatimXMLEnd($hParser, $sName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($aCMDResult['link']))
|
if (isset($aCMDResult['link']))
|
||||||
{
|
{
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
$aWikiArticles = $oDB->getAll("select * from wikipedia_article where language = 'en' and lat is not null and osm_type is null and totalcount < 31 order by importance desc limit 200000");
|
$aWikiArticles = $oDB->getAll("select * from wikipedia_article where language = 'en' and lat is not null and osm_type is null and totalcount < 31 order by importance desc limit 200000");
|
||||||
|
|
||||||
@@ -591,4 +591,4 @@ EOD;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Create and setup nominatim search system",
|
"Create and setup nominatim search system",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
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('parse-tiger', '', 0, 1, 1, 1, 'realpath', 'Convert tiger edge files to nominatim sql import - datafiles from 2011 or later (source: edges directory of tiger data)'),
|
array('parse-tiger', '', 0, 1, 1, 1, 'realpath', 'Convert tiger edge files to nominatim sql import - datafiles from 2011 or later (source: edges directory of tiger data)'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
|
|
||||||
if (isset($aCMDResult['parse-tiger']))
|
if (isset($aCMDResult['parse-tiger']))
|
||||||
{
|
{
|
||||||
if (!file_exists(CONST_Tiger_Data_Path)) mkdir(CONST_Tiger_Data_Path);
|
if (!file_exists(CONST_Tiger_Data_Path)) mkdir(CONST_Tiger_Data_Path);
|
||||||
|
|
||||||
$sTempDir = tempnam('/tmp', 'tiger');
|
$sTempDir = tempnam('/tmp', 'tiger');
|
||||||
@@ -58,4 +58,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
require_once(CONST_BasePath.'/lib/Geocode.php');
|
require_once(CONST_BasePath.'/lib/Geocode.php');
|
||||||
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
require_once(CONST_BasePath.'/lib/ParameterParser.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Query database from command line. Returns search result as JSON.",
|
"Query database from command line. Returns search result as JSON.",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
array('featureType', '', 0, 1, 1, 1, 'string', 'Restrict results to certain features (country, state,city,settlement)'),
|
array('featureType', '', 0, 1, 1, 1, 'string', 'Restrict results to certain features (country, state,city,settlement)'),
|
||||||
array('countrycodes', '', 0, 1, 1, 1, 'string', 'Comma-separated list of countries to restrict search to'),
|
array('countrycodes', '', 0, 1, 1, 1, 'string', 'Comma-separated list of countries to restrict search to'),
|
||||||
array('viewbox', '', 0, 1, 1, 1, 'string', 'Prefer results in given view box')
|
array('viewbox', '', 0, 1, 1, 1, 'string', 'Prefer results in given view box')
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
$oParams = new ParameterParser($aCMDResult);
|
$oParams = new ParameterParser($aCMDResult);
|
||||||
|
|
||||||
if ($oParams->getBool('search'))
|
if ($oParams->getBool('search'))
|
||||||
{
|
{
|
||||||
if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false';
|
if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false';
|
||||||
|
|
||||||
$oGeocode = new Geocode($oDB);
|
$oGeocode = new Geocode($oDB);
|
||||||
@@ -45,11 +45,8 @@
|
|||||||
echo json_encode($aSearchResults);
|
echo json_encode($aSearchResults);
|
||||||
else
|
else
|
||||||
echo json_encode($aSearchResults, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n";
|
echo json_encode($aSearchResults, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showUsage($aCMDOptions, true);
|
showUsage($aCMDOptions, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Apache log file
|
// Apache log file
|
||||||
$sFile = "sample.log.txt";
|
$sFile = "sample.log.txt";
|
||||||
$sHost1 = 'http://mq-open-search-lm02.ihost.aol.com:8000/nominatim/v1';
|
$sHost1 = 'http://mq-open-search-lm02.ihost.aol.com:8000/nominatim/v1';
|
||||||
$sHost2 = 'http://mq-open-search-lm03.ihost.aol.com:8000/nominatim/v1';
|
$sHost2 = 'http://mq-open-search-lm03.ihost.aol.com:8000/nominatim/v1';
|
||||||
|
|
||||||
|
|
||||||
$sHost1Escaped = str_replace('/', '\\/', $sHost1);
|
$sHost1Escaped = str_replace('/', '\\/', $sHost1);
|
||||||
$sHost2Escaped = str_replace('/', '\\/', $sHost2);
|
$sHost2Escaped = str_replace('/', '\\/', $sHost2);
|
||||||
|
|
||||||
$aToDo = array(251, 293, 328, 399.1, 455.1, 479, 496, 499, 574, 609, 702, 790, 846, 865, 878, 894, 902, 961, 980);
|
$aToDo = array(251, 293, 328, 399.1, 455.1, 479, 496, 499, 574, 609, 702, 790, 846, 865, 878, 894, 902, 961, 980);
|
||||||
|
|
||||||
$hFile = @fopen($sFile, "r");
|
$hFile = @fopen($sFile, "r");
|
||||||
if (!$hFile)
|
if (!$hFile)
|
||||||
{
|
{
|
||||||
echo "Unable to open file: $sFile\n";
|
echo "Unable to open file: $sFile\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while (($sLine = fgets($hFile, 10000)) !== false)
|
while (($sLine = fgets($hFile, 10000)) !== false)
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
if (!in_array($i, $aToDo)) continue;
|
if (!in_array($i, $aToDo)) continue;
|
||||||
|
|
||||||
@@ -73,6 +73,6 @@
|
|||||||
{
|
{
|
||||||
var_dump($sLine);
|
var_dump($sLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($hFile);
|
fclose($hFile);
|
||||||
|
|||||||
206
utils/setup.php
206
utils/setup.php
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Create and setup nominatim search system",
|
"Create and setup nominatim search system",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
||||||
@@ -38,14 +38,14 @@
|
|||||||
array('index-noanalyse', '', 0, 1, 0, 0, 'bool', 'Do not perform analyse operations during index (EXPERT)'),
|
array('index-noanalyse', '', 0, 1, 0, 0, 'bool', 'Do not perform analyse operations during index (EXPERT)'),
|
||||||
array('create-search-indices', '', 0, 1, 0, 0, 'bool', 'Create additional indices required for search and update'),
|
array('create-search-indices', '', 0, 1, 0, 0, 'bool', 'Create additional indices required for search and update'),
|
||||||
array('drop', '', 0, 1, 0, 0, 'bool', 'Drop tables needed for updates, making the database readonly (EXPERIMENTAL)'),
|
array('drop', '', 0, 1, 0, 0, 'bool', 'Drop tables needed for updates, making the database readonly (EXPERIMENTAL)'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
|
||||||
|
|
||||||
$bDidSomething = false;
|
$bDidSomething = false;
|
||||||
|
|
||||||
// Check if osm-file is set and points to a valid file if --all or --import-data is given
|
// Check if osm-file is set and points to a valid file if --all or --import-data is given
|
||||||
if ($aCMDResult['import-data'] || $aCMDResult['all'])
|
if ($aCMDResult['import-data'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
if (!isset($aCMDResult['osm-file']))
|
if (!isset($aCMDResult['osm-file']))
|
||||||
{
|
{
|
||||||
fail('missing --osm-file for data import');
|
fail('missing --osm-file for data import');
|
||||||
@@ -60,37 +60,37 @@
|
|||||||
{
|
{
|
||||||
fail('osm-file "'.$aCMDResult['osm-file'].'" not readable');
|
fail('osm-file "'.$aCMDResult['osm-file'].'" not readable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is a pretty hard core default - the number of processors in the box - 1
|
// This is a pretty hard core default - the number of processors in the box - 1
|
||||||
$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
|
$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
|
||||||
if ($iInstances < 1)
|
if ($iInstances < 1)
|
||||||
{
|
{
|
||||||
$iInstances = 1;
|
$iInstances = 1;
|
||||||
echo "WARNING: resetting threads to $iInstances\n";
|
echo "WARNING: resetting threads to $iInstances\n";
|
||||||
}
|
}
|
||||||
if ($iInstances > getProcessorCount())
|
if ($iInstances > getProcessorCount())
|
||||||
{
|
{
|
||||||
$iInstances = getProcessorCount();
|
$iInstances = getProcessorCount();
|
||||||
echo "WARNING: resetting threads to $iInstances\n";
|
echo "WARNING: resetting threads to $iInstances\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assume we can steal all the cache memory in the box (unless told otherwise)
|
// Assume we can steal all the cache memory in the box (unless told otherwise)
|
||||||
if (isset($aCMDResult['osm2pgsql-cache']))
|
if (isset($aCMDResult['osm2pgsql-cache']))
|
||||||
{
|
{
|
||||||
$iCacheMemory = $aCMDResult['osm2pgsql-cache'];
|
$iCacheMemory = $aCMDResult['osm2pgsql-cache'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$iCacheMemory = getCacheMemoryMB();
|
$iCacheMemory = getCacheMemoryMB();
|
||||||
}
|
}
|
||||||
|
|
||||||
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
||||||
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
||||||
|
|
||||||
if ($aCMDResult['create-db'] || $aCMDResult['all'])
|
if ($aCMDResult['create-db'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Create DB\n";
|
echo "Create DB\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
$oDB = DB::connect(CONST_Database_DSN, false);
|
$oDB = DB::connect(CONST_Database_DSN, false);
|
||||||
@@ -99,10 +99,10 @@
|
|||||||
fail('database already exists ('.CONST_Database_DSN.')');
|
fail('database already exists ('.CONST_Database_DSN.')');
|
||||||
}
|
}
|
||||||
passthruCheckReturn('createdb -E UTF-8 -p '.$aDSNInfo['port'].' '.$aDSNInfo['database']);
|
passthruCheckReturn('createdb -E UTF-8 -p '.$aDSNInfo['port'].' '.$aDSNInfo['database']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['setup-db'] || $aCMDResult['all'])
|
if ($aCMDResult['setup-db'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Setup DB\n";
|
echo "Setup DB\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
// TODO: path detection, detection memory, etc.
|
// TODO: path detection, detection memory, etc.
|
||||||
@@ -168,10 +168,10 @@
|
|||||||
// versions in create-tables.
|
// versions in create-tables.
|
||||||
pgsqlRunScript('CREATE TABLE place_boundingbox ()');
|
pgsqlRunScript('CREATE TABLE place_boundingbox ()');
|
||||||
pgsqlRunScript('create type wikipedia_article_match as ()');
|
pgsqlRunScript('create type wikipedia_article_match as ()');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['import-data'] || $aCMDResult['all'])
|
if ($aCMDResult['import-data'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Import\n";
|
echo "Import\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
@@ -205,18 +205,18 @@
|
|||||||
{
|
{
|
||||||
fail('No Data');
|
fail('No Data');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-functions'] || $aCMDResult['all'])
|
if ($aCMDResult['create-functions'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Functions\n";
|
echo "Functions\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
if (!file_exists(CONST_InstallPath.'/module/nominatim.so')) fail("nominatim module not built");
|
if (!file_exists(CONST_InstallPath.'/module/nominatim.so')) fail("nominatim module not built");
|
||||||
create_sql_functions($aCMDResult);
|
create_sql_functions($aCMDResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-tables'] || $aCMDResult['all'])
|
if ($aCMDResult['create-tables'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
echo "Tables\n";
|
echo "Tables\n";
|
||||||
@@ -239,10 +239,10 @@
|
|||||||
// re-run the functions
|
// re-run the functions
|
||||||
echo "Functions\n";
|
echo "Functions\n";
|
||||||
create_sql_functions($aCMDResult);
|
create_sql_functions($aCMDResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-partition-tables'] || $aCMDResult['all'])
|
if ($aCMDResult['create-partition-tables'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Partition Tables\n";
|
echo "Partition Tables\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
@@ -261,21 +261,21 @@
|
|||||||
CONST_Tablespace_Aux_Index, $sTemplate);
|
CONST_Tablespace_Aux_Index, $sTemplate);
|
||||||
|
|
||||||
pgsqlRunPartitionScript($sTemplate);
|
pgsqlRunPartitionScript($sTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($aCMDResult['create-partition-functions'] || $aCMDResult['all'])
|
if ($aCMDResult['create-partition-functions'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Partition Functions\n";
|
echo "Partition Functions\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
$sTemplate = file_get_contents(CONST_BasePath.'/sql/partition-functions.src.sql');
|
$sTemplate = file_get_contents(CONST_BasePath.'/sql/partition-functions.src.sql');
|
||||||
|
|
||||||
pgsqlRunPartitionScript($sTemplate);
|
pgsqlRunPartitionScript($sTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all'])
|
if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
$sWikiArticlesFile = CONST_BasePath.'/data/wikipedia_article.sql.bin';
|
$sWikiArticlesFile = CONST_BasePath.'/data/wikipedia_article.sql.bin';
|
||||||
$sWikiRedirectsFile = CONST_BasePath.'/data/wikipedia_redirect.sql.bin';
|
$sWikiRedirectsFile = CONST_BasePath.'/data/wikipedia_redirect.sql.bin';
|
||||||
@@ -299,11 +299,11 @@
|
|||||||
{
|
{
|
||||||
echo "WARNING: wikipedia redirect dump file not found - some place importance values may be missing\n";
|
echo "WARNING: wikipedia redirect dump file not found - some place importance values may be missing\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($aCMDResult['load-data'] || $aCMDResult['all'])
|
if ($aCMDResult['load-data'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Drop old Data\n";
|
echo "Drop old Data\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
@@ -384,10 +384,10 @@
|
|||||||
echo "\n";
|
echo "\n";
|
||||||
echo "Reanalysing database...\n";
|
echo "Reanalysing database...\n";
|
||||||
pgsqlRunScript('ANALYSE');
|
pgsqlRunScript('ANALYSE');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['import-tiger-data'])
|
if ($aCMDResult['import-tiger-data'])
|
||||||
{
|
{
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
$sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql');
|
$sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql');
|
||||||
@@ -455,10 +455,10 @@
|
|||||||
$sTemplate = replace_tablespace('{ts:aux-index}',
|
$sTemplate = replace_tablespace('{ts:aux-index}',
|
||||||
CONST_Tablespace_Aux_Index, $sTemplate);
|
CONST_Tablespace_Aux_Index, $sTemplate);
|
||||||
pgsqlRunScript($sTemplate, false);
|
pgsqlRunScript($sTemplate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all'])
|
if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
if (!pg_query($oDB->connection, 'DELETE from placex where osm_type=\'P\'')) fail(pg_last_error($oDB->connection));
|
if (!pg_query($oDB->connection, 'DELETE from placex where osm_type=\'P\'')) fail(pg_last_error($oDB->connection));
|
||||||
@@ -476,10 +476,10 @@
|
|||||||
$sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from us_postcode";
|
$sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from us_postcode";
|
||||||
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
|
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['osmosis-init'] || ($aCMDResult['all'] && !$aCMDResult['drop'])) // no use doing osmosis-init when dropping update tables
|
if ($aCMDResult['osmosis-init'] || ($aCMDResult['all'] && !$aCMDResult['drop'])) // no use doing osmosis-init when dropping update tables
|
||||||
{
|
{
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
@@ -570,10 +570,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['index'] || $aCMDResult['all'])
|
if ($aCMDResult['index'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
$sOutputFile = '';
|
$sOutputFile = '';
|
||||||
$sBaseCmd = CONST_InstallPath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'].' -t '.$iInstances.$sOutputFile;
|
$sBaseCmd = CONST_InstallPath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'].' -t '.$iInstances.$sOutputFile;
|
||||||
@@ -582,10 +582,10 @@
|
|||||||
passthruCheckReturn($sBaseCmd.' -r 5 -R 25');
|
passthruCheckReturn($sBaseCmd.' -r 5 -R 25');
|
||||||
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
|
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
|
||||||
passthruCheckReturn($sBaseCmd.' -r 26');
|
passthruCheckReturn($sBaseCmd.' -r 26');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
|
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Search indices\n";
|
echo "Search indices\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
|
|
||||||
@@ -598,10 +598,10 @@
|
|||||||
CONST_Tablespace_Aux_Index, $sTemplate);
|
CONST_Tablespace_Aux_Index, $sTemplate);
|
||||||
|
|
||||||
pgsqlRunScript($sTemplate);
|
pgsqlRunScript($sTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['drop'])
|
if ($aCMDResult['drop'])
|
||||||
{
|
{
|
||||||
// The implementation is potentially a bit dangerous because it uses
|
// The implementation is potentially a bit dangerous because it uses
|
||||||
// a positive selection of tables to keep, and deletes everything else.
|
// a positive selection of tables to keep, and deletes everything else.
|
||||||
// Including any tables that the unsuspecting user might have manually
|
// Including any tables that the unsuspecting user might have manually
|
||||||
@@ -658,19 +658,19 @@
|
|||||||
if ($aCMDResult['verbose']) echo "deleting ".CONST_Osm2pgsql_Flatnode_File."\n";
|
if ($aCMDResult['verbose']) echo "deleting ".CONST_Osm2pgsql_Flatnode_File."\n";
|
||||||
unlink(CONST_Osm2pgsql_Flatnode_File);
|
unlink(CONST_Osm2pgsql_Flatnode_File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$bDidSomething)
|
if (!$bDidSomething)
|
||||||
{
|
{
|
||||||
showUsage($aCMDOptions, true);
|
showUsage($aCMDOptions, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "Setup finished.\n";
|
echo "Setup finished.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function pgsqlRunScriptFile($sFilename)
|
function pgsqlRunScriptFile($sFilename)
|
||||||
{
|
{
|
||||||
if (!file_exists($sFilename)) fail('unable to find '.$sFilename);
|
if (!file_exists($sFilename)) fail('unable to find '.$sFilename);
|
||||||
|
|
||||||
// Convert database DSN to psql parameters
|
// Convert database DSN to psql parameters
|
||||||
@@ -725,10 +725,10 @@
|
|||||||
proc_close($hGzipProcess);
|
proc_close($hGzipProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pgsqlRunScript($sScript, $bfatal = true)
|
function pgsqlRunScript($sScript, $bfatal = true)
|
||||||
{
|
{
|
||||||
global $aCMDResult;
|
global $aCMDResult;
|
||||||
// Convert database DSN to psql parameters
|
// Convert database DSN to psql parameters
|
||||||
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
||||||
@@ -757,10 +757,10 @@
|
|||||||
{
|
{
|
||||||
fail("pgsql returned with error code ($iReturn)");
|
fail("pgsql returned with error code ($iReturn)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pgsqlRunPartitionScript($sTemplate)
|
function pgsqlRunPartitionScript($sTemplate)
|
||||||
{
|
{
|
||||||
global $aCMDResult;
|
global $aCMDResult;
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
@@ -780,10 +780,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
pgsqlRunScript($sTemplate);
|
pgsqlRunScript($sTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pgsqlRunRestoreData($sDumpFile)
|
function pgsqlRunRestoreData($sDumpFile)
|
||||||
{
|
{
|
||||||
// Convert database DSN to psql parameters
|
// Convert database DSN to psql parameters
|
||||||
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
||||||
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
||||||
@@ -808,10 +808,10 @@
|
|||||||
fclose($ahPipes[1]);
|
fclose($ahPipes[1]);
|
||||||
|
|
||||||
$iReturn = proc_close($hProcess);
|
$iReturn = proc_close($hProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pgsqlRunDropAndRestore($sDumpFile)
|
function pgsqlRunDropAndRestore($sDumpFile)
|
||||||
{
|
{
|
||||||
// Convert database DSN to psql parameters
|
// Convert database DSN to psql parameters
|
||||||
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
||||||
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
||||||
@@ -836,17 +836,17 @@
|
|||||||
fclose($ahPipes[1]);
|
fclose($ahPipes[1]);
|
||||||
|
|
||||||
$iReturn = proc_close($hProcess);
|
$iReturn = proc_close($hProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
function passthruCheckReturn($cmd)
|
function passthruCheckReturn($cmd)
|
||||||
{
|
{
|
||||||
$result = -1;
|
$result = -1;
|
||||||
passthru($cmd, $result);
|
passthru($cmd, $result);
|
||||||
if ($result != 0) fail('Error executing external command: '.$cmd);
|
if ($result != 0) fail('Error executing external command: '.$cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
function replace_tablespace($sTemplate, $sTablespace, $sSql)
|
function replace_tablespace($sTemplate, $sTablespace, $sSql)
|
||||||
{
|
{
|
||||||
if ($sTablespace)
|
if ($sTablespace)
|
||||||
$sSql = str_replace($sTemplate, 'TABLESPACE "'.$sTablespace.'"',
|
$sSql = str_replace($sTemplate, 'TABLESPACE "'.$sTablespace.'"',
|
||||||
$sSql);
|
$sSql);
|
||||||
@@ -854,10 +854,10 @@
|
|||||||
$sSql = str_replace($sTemplate, '', $sSql);
|
$sSql = str_replace($sTemplate, '', $sSql);
|
||||||
|
|
||||||
return $sSql;
|
return $sSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_sql_functions($aCMDResult)
|
function create_sql_functions($aCMDResult)
|
||||||
{
|
{
|
||||||
$sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql');
|
$sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql');
|
||||||
$sTemplate = str_replace('{modulepath}', CONST_InstallPath.'/module', $sTemplate);
|
$sTemplate = str_replace('{modulepath}', CONST_InstallPath.'/module', $sTemplate);
|
||||||
if ($aCMDResult['enable-diff-updates'])
|
if ($aCMDResult['enable-diff-updates'])
|
||||||
@@ -882,5 +882,5 @@
|
|||||||
}
|
}
|
||||||
pgsqlRunScript($sTemplate);
|
pgsqlRunScript($sTemplate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
ini_set('display_errors', 'stderr');
|
ini_set('display_errors', 'stderr');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Import and export special phrases",
|
"Import and export special phrases",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
include(CONST_InstallPath.'/settings/phrase_settings.php');
|
include(CONST_InstallPath.'/settings/phrase_settings.php');
|
||||||
|
|
||||||
|
|
||||||
if ($aCMDResult['countries']) {
|
if ($aCMDResult['countries']) {
|
||||||
echo "select getorcreate_country(make_standard_name('uk'), 'gb');\n";
|
echo "select getorcreate_country(make_standard_name('uk'), 'gb');\n";
|
||||||
echo "select getorcreate_country(make_standard_name('united states'), 'us');\n";
|
echo "select getorcreate_country(make_standard_name('united states'), 'us');\n";
|
||||||
echo "select count(*) from (select getorcreate_country(make_standard_name(country_code), country_code) from country_name where country_code is not null) as x;\n";
|
echo "select count(*) from (select getorcreate_country(make_standard_name(country_code), country_code) from country_name where country_code is not null) as x;\n";
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
{
|
{
|
||||||
echo "select count(*) from (select getorcreate_country(make_standard_name(get_name_by_language(country_name.name,ARRAY['name:".$sLanguage."'])), country_code) from country_name where get_name_by_language(country_name.name, ARRAY['name:".$sLanguage."']) is not null) as x;\n";
|
echo "select count(*) from (select getorcreate_country(make_standard_name(get_name_by_language(country_name.name,ARRAY['name:".$sLanguage."'])), country_code) from country_name where get_name_by_language(country_name.name, ARRAY['name:".$sLanguage."']) is not null) as x;\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['wiki-import'])
|
if ($aCMDResult['wiki-import'])
|
||||||
{
|
{
|
||||||
$aPairs = array();
|
$aPairs = array();
|
||||||
|
|
||||||
foreach($aLanguageIn as $sLanguage)
|
foreach($aLanguageIn as $sLanguage)
|
||||||
@@ -111,4 +111,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "drop index idx_placex_classtype;";
|
echo "drop index idx_placex_classtype;";
|
||||||
}
|
}
|
||||||
|
|||||||
116
utils/update.php
116
utils/update.php
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Import / update / index osm data",
|
"Import / update / index osm data",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
|
||||||
@@ -32,35 +32,35 @@
|
|||||||
array('index-instances', '', 0, 1, 1, 1, 'int', 'Number of indexing instances (threads)'),
|
array('index-instances', '', 0, 1, 1, 1, 'int', 'Number of indexing instances (threads)'),
|
||||||
|
|
||||||
array('deduplicate', '', 0, 1, 0, 0, 'bool', 'Deduplicate tokens'),
|
array('deduplicate', '', 0, 1, 0, 0, 'bool', 'Deduplicate tokens'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
||||||
|
|
||||||
if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
|
if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
|
||||||
if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;
|
if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;
|
||||||
|
|
||||||
date_default_timezone_set('Etc/UTC');
|
date_default_timezone_set('Etc/UTC');
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
|
||||||
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
|
||||||
|
|
||||||
// cache memory to be used by osm2pgsql, should not be more than the available memory
|
// cache memory to be used by osm2pgsql, should not be more than the available memory
|
||||||
$iCacheMemory = (isset($aResult['osm2pgsql-cache'])?$aResult['osm2pgsql-cache']:2000);
|
$iCacheMemory = (isset($aResult['osm2pgsql-cache'])?$aResult['osm2pgsql-cache']:2000);
|
||||||
if ($iCacheMemory + 500 > getTotalMemoryMB())
|
if ($iCacheMemory + 500 > getTotalMemoryMB())
|
||||||
{
|
{
|
||||||
$iCacheMemory = getCacheMemoryMB();
|
$iCacheMemory = getCacheMemoryMB();
|
||||||
echo "WARNING: resetting cache memory to $iCacheMemory\n";
|
echo "WARNING: resetting cache memory to $iCacheMemory\n";
|
||||||
}
|
}
|
||||||
$sOsm2pgsqlCmd = CONST_Osm2pgsql_Binary.' -klas --number-processes 1 -C '.$iCacheMemory.' -O gazetteer -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'];
|
$sOsm2pgsqlCmd = CONST_Osm2pgsql_Binary.' -klas --number-processes 1 -C '.$iCacheMemory.' -O gazetteer -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'];
|
||||||
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
|
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
|
||||||
{
|
{
|
||||||
$sOsm2pgsqlCmd .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
|
$sOsm2pgsqlCmd .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($aResult['import-diff']))
|
if (isset($aResult['import-diff']))
|
||||||
{
|
{
|
||||||
// import diff directly (e.g. from osmosis --rri)
|
// import diff directly (e.g. from osmosis --rri)
|
||||||
$sNextFile = $aResult['import-diff'];
|
$sNextFile = $aResult['import-diff'];
|
||||||
if (!file_exists($sNextFile))
|
if (!file_exists($sNextFile))
|
||||||
@@ -79,12 +79,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't update the import status - we don't know what this file contains
|
// Don't update the import status - we don't know what this file contains
|
||||||
}
|
}
|
||||||
|
|
||||||
$sTemporaryFile = CONST_BasePath.'/data/osmosischange.osc';
|
$sTemporaryFile = CONST_BasePath.'/data/osmosischange.osc';
|
||||||
$bHaveDiff = false;
|
$bHaveDiff = false;
|
||||||
if (isset($aResult['import-file']) && $aResult['import-file'])
|
if (isset($aResult['import-file']) && $aResult['import-file'])
|
||||||
{
|
{
|
||||||
$bHaveDiff = true;
|
$bHaveDiff = true;
|
||||||
$sCMD = CONST_Osmosis_Binary.' --read-xml \''.$aResult['import-file'].'\' --read-empty --derive-change --write-xml-change '.$sTemporaryFile;
|
$sCMD = CONST_Osmosis_Binary.' --read-xml \''.$aResult['import-file'].'\' --read-empty --derive-change --write-xml-change '.$sTemporaryFile;
|
||||||
echo $sCMD."\n";
|
echo $sCMD."\n";
|
||||||
@@ -93,12 +93,12 @@
|
|||||||
{
|
{
|
||||||
fail("Error converting osm to osc, osmosis returned: $iErrorLevel\n");
|
fail("Error converting osm to osc, osmosis returned: $iErrorLevel\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$bUseOSMApi = isset($aResult['import-from-main-api']) && $aResult['import-from-main-api'];
|
$bUseOSMApi = isset($aResult['import-from-main-api']) && $aResult['import-from-main-api'];
|
||||||
$sContentURL = '';
|
$sContentURL = '';
|
||||||
if (isset($aResult['import-node']) && $aResult['import-node'])
|
if (isset($aResult['import-node']) && $aResult['import-node'])
|
||||||
{
|
{
|
||||||
if ($bUseOSMApi)
|
if ($bUseOSMApi)
|
||||||
{
|
{
|
||||||
$sContentURL = 'http://www.openstreetmap.org/api/0.6/node/'.$aResult['import-node'];
|
$sContentURL = 'http://www.openstreetmap.org/api/0.6/node/'.$aResult['import-node'];
|
||||||
@@ -107,9 +107,9 @@
|
|||||||
{
|
{
|
||||||
$sContentURL = 'http://overpass-api.de/api/interpreter?data=node('.$aResult['import-node'].');out%20meta;';
|
$sContentURL = 'http://overpass-api.de/api/interpreter?data=node('.$aResult['import-node'].');out%20meta;';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($aResult['import-way']) && $aResult['import-way'])
|
if (isset($aResult['import-way']) && $aResult['import-way'])
|
||||||
{
|
{
|
||||||
if ($bUseOSMApi)
|
if ($bUseOSMApi)
|
||||||
{
|
{
|
||||||
$sContentURL = 'http://www.openstreetmap.org/api/0.6/way/'.$aResult['import-way'].'/full';
|
$sContentURL = 'http://www.openstreetmap.org/api/0.6/way/'.$aResult['import-way'].'/full';
|
||||||
@@ -118,9 +118,9 @@
|
|||||||
{
|
{
|
||||||
$sContentURL = 'http://overpass-api.de/api/interpreter?data=(way('.$aResult['import-way'].');node(w););out%20meta;';
|
$sContentURL = 'http://overpass-api.de/api/interpreter?data=(way('.$aResult['import-way'].');node(w););out%20meta;';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($aResult['import-relation']) && $aResult['import-relation'])
|
if (isset($aResult['import-relation']) && $aResult['import-relation'])
|
||||||
{
|
{
|
||||||
if ($bUseOSMApi)
|
if ($bUseOSMApi)
|
||||||
{
|
{
|
||||||
$sContentURLsModifyXMLstr = 'http://www.openstreetmap.org/api/0.6/relation/'.$aResult['import-relation'].'/full';
|
$sContentURLsModifyXMLstr = 'http://www.openstreetmap.org/api/0.6/relation/'.$aResult['import-relation'].'/full';
|
||||||
@@ -129,9 +129,9 @@
|
|||||||
{
|
{
|
||||||
$sContentURL = 'http://overpass-api.de/api/interpreter?data=((rel('.$aResult['import-relation'].');way(r);node(w));node(r));out%20meta;';
|
$sContentURL = 'http://overpass-api.de/api/interpreter?data=((rel('.$aResult['import-relation'].');way(r);node(w));node(r));out%20meta;';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($sContentURL)
|
if ($sContentURL)
|
||||||
{
|
{
|
||||||
$sModifyXMLstr = file_get_contents($sContentURL);
|
$sModifyXMLstr = file_get_contents($sContentURL);
|
||||||
$bHaveDiff = true;
|
$bHaveDiff = true;
|
||||||
|
|
||||||
@@ -161,10 +161,10 @@
|
|||||||
echo $sErrors;
|
echo $sErrors;
|
||||||
fail("Error converting osm to osc, osmosis returned: $iError\n");
|
fail("Error converting osm to osc, osmosis returned: $iError\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bHaveDiff)
|
if ($bHaveDiff)
|
||||||
{
|
{
|
||||||
// import generated change file
|
// import generated change file
|
||||||
$sCMD = $sOsm2pgsqlCmd.' '.$sTemporaryFile;
|
$sCMD = $sOsm2pgsqlCmd.' '.$sTemporaryFile;
|
||||||
echo $sCMD."\n";
|
echo $sCMD."\n";
|
||||||
@@ -173,10 +173,10 @@
|
|||||||
{
|
{
|
||||||
fail("osm2pgsql exited with error level $iErrorLevel\n");
|
fail("osm2pgsql exited with error level $iErrorLevel\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['deduplicate'])
|
if ($aResult['deduplicate'])
|
||||||
{
|
{
|
||||||
|
|
||||||
if (getPostgresVersion() < 9.3)
|
if (getPostgresVersion() < 9.3)
|
||||||
{
|
{
|
||||||
@@ -235,15 +235,15 @@
|
|||||||
chksql($oDB->query($sSQL));
|
chksql($oDB->query($sSQL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['index'])
|
if ($aResult['index'])
|
||||||
{
|
{
|
||||||
passthru(CONST_InstallPath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'].' -t '.$aResult['index-instances'].' -r '.$aResult['index-rank']);
|
passthru(CONST_InstallPath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'].' -t '.$aResult['index-instances'].' -r '.$aResult['index-rank']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['import-osmosis'] || $aResult['import-osmosis-all'])
|
if ($aResult['import-osmosis'] || $aResult['import-osmosis-all'])
|
||||||
{
|
{
|
||||||
|
|
||||||
if (strpos(CONST_Replication_Url, 'download.geofabrik.de') !== false && CONST_Replication_Update_Interval < 86400) {
|
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://wiki.openstreetmap.org/wiki/Nominatim/Installation#Updates)\n");
|
fail("Error: Update interval too low for download.geofabrik.de. Please check install documentation (http://wiki.openstreetmap.org/wiki/Nominatim/Installation#Updates)\n");
|
||||||
@@ -366,11 +366,11 @@
|
|||||||
echo date('Y-m-d H:i:s')." Sleeping $iSleep seconds\n";
|
echo date('Y-m-d H:i:s')." Sleeping $iSleep seconds\n";
|
||||||
sleep($iSleep);
|
sleep($iSleep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getosmosistimestamp($sOsmosisConfigDirectory)
|
function getosmosistimestamp($sOsmosisConfigDirectory)
|
||||||
{
|
{
|
||||||
$sStateFile = file_get_contents($sOsmosisConfigDirectory.'/state.txt');
|
$sStateFile = file_get_contents($sOsmosisConfigDirectory.'/state.txt');
|
||||||
preg_match('#timestamp=(.+)#', $sStateFile, $aResult);
|
preg_match('#timestamp=(.+)#', $sStateFile, $aResult);
|
||||||
return str_replace('\:',':',$aResult[1]);
|
return str_replace('\:',':',$aResult[1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
#!/usr/bin/php -Cq
|
#!/usr/bin/php -Cq
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
require_once(CONST_BasePath.'/lib/init-cmd.php');
|
||||||
ini_set('memory_limit', '800M');
|
ini_set('memory_limit', '800M');
|
||||||
|
|
||||||
$aCMDOptions = array(
|
$aCMDOptions = array(
|
||||||
"Tools to warm nominatim db",
|
"Tools to warm nominatim db",
|
||||||
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
|
||||||
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('reverse-only', '', 0, 1, 0, 0, 'bool', 'Warm reverse only'),
|
array('reverse-only', '', 0, 1, 0, 0, 'bool', 'Warm reverse only'),
|
||||||
array('search-only', '', 0, 1, 0, 0, 'bool', 'Warm reverse only'),
|
array('search-only', '', 0, 1, 0, 0, 'bool', 'Warm reverse only'),
|
||||||
);
|
);
|
||||||
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
|
||||||
|
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/Geocode.php');
|
require_once(CONST_BasePath.'/lib/Geocode.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
$bVerbose = $aResult['verbose'];
|
$bVerbose = $aResult['verbose'];
|
||||||
|
|
||||||
if (!$aResult['search-only']) {
|
if (!$aResult['search-only']) {
|
||||||
|
|
||||||
$oReverseGeocode = new ReverseGeocode($oDB);
|
$oReverseGeocode = new ReverseGeocode($oDB);
|
||||||
$oReverseGeocode->setZoom(20);
|
$oReverseGeocode->setZoom(20);
|
||||||
@@ -48,9 +48,9 @@
|
|||||||
else echo ".";
|
else echo ".";
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$aResult['reverse-only']) {
|
if (!$aResult['reverse-only']) {
|
||||||
|
|
||||||
$oGeocode =& new Geocode($oDB);
|
$oGeocode =& new Geocode($oDB);
|
||||||
|
|
||||||
@@ -65,5 +65,5 @@
|
|||||||
if ($bVerbose) echo $aSearchResults[0]['langaddress']."\n";
|
if ($bVerbose) echo $aSearchResults[0]['langaddress']."\n";
|
||||||
else echo ".";
|
else echo ".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Details');
|
@define('CONST_ConnectionBucket_PageType', 'Details');
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oParams = new ParameterParser();
|
$oParams = new ParameterParser();
|
||||||
|
|
||||||
$sOutputFormat = 'html';
|
$sOutputFormat = 'html';
|
||||||
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
||||||
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
|
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
|
||||||
|
|
||||||
$sPlaceId = $oParams->getString('place_id');
|
$sPlaceId = $oParams->getString('place_id');
|
||||||
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
|
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
|
||||||
$iOsmId = $oParams->getInt('osmid', -1);
|
$iOsmId = $oParams->getInt('osmid', -1);
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
if ($sOsmType && $iOsmId > 0)
|
if ($sOsmType && $iOsmId > 0)
|
||||||
{
|
{
|
||||||
$sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));
|
$sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));
|
||||||
|
|
||||||
// Be nice about our error messages for broken geometry
|
// Be nice about our error messages for broken geometry
|
||||||
@@ -43,91 +43,91 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$sPlaceId) userError("Please select a place id");
|
if (!$sPlaceId) userError("Please select a place id");
|
||||||
|
|
||||||
$iPlaceID = (int)$sPlaceId;
|
$iPlaceID = (int)$sPlaceId;
|
||||||
|
|
||||||
if (CONST_Use_US_Tiger_Data)
|
if (CONST_Use_US_Tiger_Data)
|
||||||
{
|
{
|
||||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_tiger where place_id = '.$iPlaceID));
|
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_tiger where place_id = '.$iPlaceID));
|
||||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONST_Use_Aux_Location_data)
|
if (CONST_Use_Aux_Location_data)
|
||||||
{
|
{
|
||||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID));
|
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID));
|
||||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hLog = logStart($oDB, 'details', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
$hLog = logStart($oDB, 'details', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
||||||
|
|
||||||
// Get the details for this point
|
// Get the details for this point
|
||||||
$sSQL = "select place_id, osm_type, osm_id, class, type, name, admin_level, housenumber, street, isin, postcode, calculated_country_code as country_code, importance, wikipedia,";
|
$sSQL = "select place_id, osm_type, osm_id, class, type, name, admin_level, housenumber, street, isin, postcode, calculated_country_code as country_code, importance, wikipedia,";
|
||||||
$sSQL .= " to_char(indexed_date, 'YYYY-MM-DD HH24:MI') as indexed_date, parent_place_id, rank_address, rank_search, get_searchrank_label(rank_search) as rank_search_label, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ";
|
$sSQL .= " to_char(indexed_date, 'YYYY-MM-DD HH24:MI') as indexed_date, parent_place_id, rank_address, rank_search, get_searchrank_label(rank_search) as rank_search_label, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ";
|
||||||
$sSQL .= " ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ";
|
$sSQL .= " ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ";
|
||||||
//$sSQL .= " ST_Area(geometry::geography) as area, ";
|
//$sSQL .= " ST_Area(geometry::geography) as area, ";
|
||||||
$sSQL .= " ST_y(centroid) as lat, ST_x(centroid) as lon,";
|
$sSQL .= " ST_y(centroid) as lat, ST_x(centroid) as lon,";
|
||||||
$sSQL .= " case when importance = 0 OR importance IS NULL then 0.75-(rank_search::float/40) else importance end as calculated_importance, ";
|
$sSQL .= " case when importance = 0 OR importance IS NULL then 0.75-(rank_search::float/40) else importance end as calculated_importance, ";
|
||||||
$sSQL .= " ST_AsText(CASE WHEN ST_NPoints(geometry) > 5000 THEN ST_SimplifyPreserveTopology(geometry, 0.0001) ELSE geometry END) as outlinestring";
|
$sSQL .= " ST_AsText(CASE WHEN ST_NPoints(geometry) > 5000 THEN ST_SimplifyPreserveTopology(geometry, 0.0001) ELSE geometry END) as outlinestring";
|
||||||
$sSQL .= " from placex where place_id = $iPlaceID";
|
$sSQL .= " from placex where place_id = $iPlaceID";
|
||||||
$aPointDetails = chksql($oDB->getRow($sSQL),
|
$aPointDetails = chksql($oDB->getRow($sSQL),
|
||||||
"Could not get details of place object.");
|
"Could not get details of place object.");
|
||||||
$aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
|
$aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
|
||||||
|
|
||||||
$aClassType = getClassTypesWithImportance();
|
$aClassType = getClassTypesWithImportance();
|
||||||
$aPointDetails['icon'] = $aClassType[$aPointDetails['class'].':'.$aPointDetails['type']]['icon'];
|
$aPointDetails['icon'] = $aClassType[$aPointDetails['class'].':'.$aPointDetails['type']]['icon'];
|
||||||
|
|
||||||
// Get all alternative names (languages, etc)
|
// Get all alternative names (languages, etc)
|
||||||
$sSQL = "select (each(name)).key,(each(name)).value from placex where place_id = $iPlaceID order by (each(name)).key";
|
$sSQL = "select (each(name)).key,(each(name)).value from placex where place_id = $iPlaceID order by (each(name)).key";
|
||||||
$aPointDetails['aNames'] = $oDB->getAssoc($sSQL);
|
$aPointDetails['aNames'] = $oDB->getAssoc($sSQL);
|
||||||
if (PEAR::isError($aPointDetails['aNames'])) // possible timeout
|
if (PEAR::isError($aPointDetails['aNames'])) // possible timeout
|
||||||
{
|
{
|
||||||
$aPointDetails['aNames'] = [];
|
$aPointDetails['aNames'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra tags
|
// Extra tags
|
||||||
$sSQL = "select (each(extratags)).key,(each(extratags)).value from placex where place_id = $iPlaceID order by (each(extratags)).key";
|
$sSQL = "select (each(extratags)).key,(each(extratags)).value from placex where place_id = $iPlaceID order by (each(extratags)).key";
|
||||||
$aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);
|
$aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);
|
||||||
if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout
|
if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout
|
||||||
{
|
{
|
||||||
$aPointDetails['aExtraTags'] = [];
|
$aPointDetails['aExtraTags'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
$aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], -1, true);
|
$aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], -1, true);
|
||||||
|
|
||||||
// Linked places
|
// Linked places
|
||||||
$sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
$sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
||||||
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
||||||
$sSQL .= " from placex, (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
$sSQL .= " from placex, (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
||||||
$sSQL .= " where linked_place_id = $iPlaceID";
|
$sSQL .= " where linked_place_id = $iPlaceID";
|
||||||
$sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
|
$sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
|
||||||
$aLinkedLines = $oDB->getAll($sSQL);
|
$aLinkedLines = $oDB->getAll($sSQL);
|
||||||
if (PEAR::isError($aLinkedLines)) // possible timeout
|
if (PEAR::isError($aLinkedLines)) // possible timeout
|
||||||
{
|
{
|
||||||
$aLinkedLines = [];
|
$aLinkedLines = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// All places this is an imediate parent of
|
// All places this is an imediate parent of
|
||||||
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
||||||
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
||||||
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
|
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
|
||||||
$sSQL .= " where parent_place_id = $iPlaceID order by rank_address asc,rank_search asc limit 500) as obj,";
|
$sSQL .= " where parent_place_id = $iPlaceID order by rank_address asc,rank_search asc limit 500) as obj,";
|
||||||
$sSQL .= " (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
$sSQL .= " (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
||||||
$sSQL .= " order by rank_address asc,rank_search asc,localname,housenumber";
|
$sSQL .= " order by rank_address asc,rank_search asc,localname,housenumber";
|
||||||
$aParentOfLines = $oDB->getAll($sSQL);
|
$aParentOfLines = $oDB->getAll($sSQL);
|
||||||
if (PEAR::isError($aParentOfLines)) // possible timeout
|
if (PEAR::isError($aParentOfLines)) // possible timeout
|
||||||
{
|
{
|
||||||
$aParentOfLines = [];
|
$aParentOfLines = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$aPlaceSearchNameKeywords = false;
|
$aPlaceSearchNameKeywords = false;
|
||||||
$aPlaceSearchAddressKeywords = false;
|
$aPlaceSearchAddressKeywords = false;
|
||||||
if ($oParams->getBool('keywords'))
|
if ($oParams->getBool('keywords'))
|
||||||
{
|
{
|
||||||
$sSQL = "select * from search_name where place_id = $iPlaceID";
|
$sSQL = "select * from search_name where place_id = $iPlaceID";
|
||||||
$aPlaceSearchName = $oDB->getRow($sSQL);
|
$aPlaceSearchName = $oDB->getRow($sSQL);
|
||||||
if (PEAR::isError($aPlaceSearchName)) // possible timeout
|
if (PEAR::isError($aPlaceSearchName)) // possible timeout
|
||||||
@@ -150,15 +150,15 @@
|
|||||||
$aPlaceSearchAddressKeywords = [];
|
$aPlaceSearchAddressKeywords = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logEnd($oDB, $hLog, 1);
|
logEnd($oDB, $hLog, 1);
|
||||||
|
|
||||||
if ($sOutputFormat=='html')
|
if ($sOutputFormat=='html')
|
||||||
{
|
{
|
||||||
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
||||||
$sTileURL = CONST_Map_Tile_URL;
|
$sTileURL = CONST_Map_Tile_URL;
|
||||||
$sTileAttribution = CONST_Map_Tile_Attribution;
|
$sTileAttribution = CONST_Map_Tile_Attribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');
|
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Details');
|
@define('CONST_ConnectionBucket_PageType', 'Details');
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oParams = new ParameterParser();
|
$oParams = new ParameterParser();
|
||||||
|
|
||||||
$sOutputFormat = $oParams->getSet('format', array('html', 'json'), 'html');
|
$sOutputFormat = $oParams->getSet('format', array('html', 'json'), 'html');
|
||||||
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
||||||
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
|
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
|
||||||
|
|
||||||
$sPlaceId = $oParams->getString('place_id');
|
$sPlaceId = $oParams->getString('place_id');
|
||||||
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
|
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
|
||||||
$iOsmId = $oParams->getInt('osmid', -1);
|
$iOsmId = $oParams->getInt('osmid', -1);
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
if ($sOsmType && $iOsmId > 0)
|
if ($sOsmType && $iOsmId > 0)
|
||||||
{
|
{
|
||||||
$sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));
|
$sPlaceId = chksql($oDB->getOne("select place_id from placex where osm_type = '".$sOsmType."' and osm_id = ".$iOsmId." order by type = 'postcode' asc"));
|
||||||
|
|
||||||
// Be nice about our error messages for broken geometry
|
// Be nice about our error messages for broken geometry
|
||||||
@@ -38,35 +38,35 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$sPlaceId) userError("Please select a place id");
|
if (!$sPlaceId) userError("Please select a place id");
|
||||||
|
|
||||||
$iPlaceID = (int)$sPlaceId;
|
$iPlaceID = (int)$sPlaceId;
|
||||||
|
|
||||||
if (CONST_Use_US_Tiger_Data)
|
if (CONST_Use_US_Tiger_Data)
|
||||||
{
|
{
|
||||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_tiger where place_id = '.$iPlaceID));
|
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_tiger where place_id = '.$iPlaceID));
|
||||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONST_Use_Aux_Location_data)
|
if (CONST_Use_Aux_Location_data)
|
||||||
{
|
{
|
||||||
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID));
|
$iParentPlaceID = chksql($oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID));
|
||||||
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oPlaceLookup = new PlaceLookup($oDB);
|
$oPlaceLookup = new PlaceLookup($oDB);
|
||||||
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
|
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
|
||||||
$oPlaceLookup->setIncludeAddressDetails(true);
|
$oPlaceLookup->setIncludeAddressDetails(true);
|
||||||
|
|
||||||
$aPlaceAddress = array_reverse($oPlaceLookup->getAddressDetails($iPlaceID));
|
$aPlaceAddress = array_reverse($oPlaceLookup->getAddressDetails($iPlaceID));
|
||||||
|
|
||||||
if (!sizeof($aPlaceAddress)) userError("Unknown place id.");
|
if (!sizeof($aPlaceAddress)) userError("Unknown place id.");
|
||||||
|
|
||||||
$aBreadcrums = array();
|
$aBreadcrums = array();
|
||||||
foreach($aPlaceAddress as $i => $aPlace)
|
foreach($aPlaceAddress as $i => $aPlace)
|
||||||
{
|
{
|
||||||
if (!$aPlace['place_id']) continue;
|
if (!$aPlace['place_id']) continue;
|
||||||
$aBreadcrums[] = array('placeId' => $aPlace['place_id'],
|
$aBreadcrums[] = array('placeId' => $aPlace['place_id'],
|
||||||
'osmType' => $aPlace['osm_type'],
|
'osmType' => $aPlace['osm_type'],
|
||||||
@@ -79,29 +79,29 @@
|
|||||||
if ($i) echo " > ";
|
if ($i) echo " > ";
|
||||||
echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> ('.osmLink($aPlace).')';
|
echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> ('.osmLink($aPlace).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($sOutputFormat == 'json')
|
if ($sOutputFormat == 'json')
|
||||||
{
|
{
|
||||||
header("content-type: application/json; charset=UTF-8");
|
header("content-type: application/json; charset=UTF-8");
|
||||||
$aDetails = array();
|
$aDetails = array();
|
||||||
$aDetails['breadcrumbs'] = $aBreadcrums;
|
$aDetails['breadcrumbs'] = $aBreadcrums;
|
||||||
javascript_renderData($aDetails);
|
javascript_renderData($aDetails);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aRelatedPlaceIDs = chksql($oDB->getCol($sSQL = "select place_id from placex where linked_place_id = $iPlaceID or place_id = $iPlaceID"));
|
$aRelatedPlaceIDs = chksql($oDB->getCol($sSQL = "select place_id from placex where linked_place_id = $iPlaceID or place_id = $iPlaceID"));
|
||||||
|
|
||||||
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_area(geometry) as area, ";
|
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_area(geometry) as area, ";
|
||||||
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
||||||
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
|
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
|
||||||
$sSQL .= " where parent_place_id in (".join(',',$aRelatedPlaceIDs).") and name is not null order by rank_address asc,rank_search asc limit 500) as obj";
|
$sSQL .= " where parent_place_id in (".join(',',$aRelatedPlaceIDs).") and name is not null order by rank_address asc,rank_search asc limit 500) as obj";
|
||||||
$sSQL .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber";
|
$sSQL .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber";
|
||||||
$aParentOfLines = chksql($oDB->getAll($sSQL));
|
$aParentOfLines = chksql($oDB->getAll($sSQL));
|
||||||
|
|
||||||
if (sizeof($aParentOfLines))
|
if (sizeof($aParentOfLines))
|
||||||
{
|
{
|
||||||
echo '<h2>Parent Of:</h2>';
|
echo '<h2>Parent Of:</h2>';
|
||||||
$aClassType = getClassTypesWithImportance();
|
$aClassType = getClassTypesWithImportance();
|
||||||
$aGroupedAddressLines = array();
|
$aGroupedAddressLines = array();
|
||||||
@@ -146,4 +146,4 @@
|
|||||||
echo '<p>There are more child objects which are not shown.</p>';
|
echo '<p>There are more child objects which are not shown.</p>';
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +1,43 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Reverse');
|
@define('CONST_ConnectionBucket_PageType', 'Reverse');
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oParams = new ParameterParser();
|
$oParams = new ParameterParser();
|
||||||
|
|
||||||
// Format for output
|
// Format for output
|
||||||
$sOutputFormat = $oParams->getSet('format', array('xml', 'json'), 'xml');
|
$sOutputFormat = $oParams->getSet('format', array('xml', 'json'), 'xml');
|
||||||
|
|
||||||
// Preferred language
|
// Preferred language
|
||||||
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
$hLog = logStart($oDB, 'place', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
$hLog = logStart($oDB, 'place', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
||||||
|
|
||||||
$aSearchResults = array();
|
$aSearchResults = array();
|
||||||
$aCleanedQueryParts = array();
|
$aCleanedQueryParts = array();
|
||||||
|
|
||||||
$oPlaceLookup = new PlaceLookup($oDB);
|
$oPlaceLookup = new PlaceLookup($oDB);
|
||||||
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
|
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
|
||||||
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
|
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
|
||||||
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
|
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
|
||||||
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
|
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
|
||||||
|
|
||||||
$aOsmIds = explode(',', $oParams->getString('osm_ids', ''));
|
$aOsmIds = explode(',', $oParams->getString('osm_ids', ''));
|
||||||
|
|
||||||
if (count($aOsmIds) > CONST_Places_Max_ID_count)
|
if (count($aOsmIds) > CONST_Places_Max_ID_count)
|
||||||
{
|
{
|
||||||
userError('Bulk User: Only ' . CONST_Places_Max_ID_count . " ids are allowed in one request.");
|
userError('Bulk User: Only ' . CONST_Places_Max_ID_count . " ids are allowed in one request.");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($aOsmIds AS $sItem)
|
foreach ($aOsmIds AS $sItem)
|
||||||
{
|
{
|
||||||
// Skip empty sItem
|
// Skip empty sItem
|
||||||
if (empty($sItem)) continue;
|
if (empty($sItem)) continue;
|
||||||
|
|
||||||
@@ -59,17 +59,17 @@
|
|||||||
$aSearchResults[] = $oResult;
|
$aSearchResults[] = $oResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CONST_Debug) exit;
|
if (CONST_Debug) exit;
|
||||||
|
|
||||||
$sXmlRootTag = 'lookupresults';
|
$sXmlRootTag = 'lookupresults';
|
||||||
$sQuery = join(',',$aCleanedQueryParts);
|
$sQuery = join(',',$aCleanedQueryParts);
|
||||||
// we initialize these to avoid warnings in our logfile
|
// we initialize these to avoid warnings in our logfile
|
||||||
$sViewBox = '';
|
$sViewBox = '';
|
||||||
$bShowPolygons = '';
|
$bShowPolygons = '';
|
||||||
$aExcludePlaceIDs = [];
|
$aExcludePlaceIDs = [];
|
||||||
$sMoreURL = '';
|
$sMoreURL = '';
|
||||||
|
|
||||||
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');
|
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Reverse');
|
@define('CONST_ConnectionBucket_PageType', 'Reverse');
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oParams = new ParameterParser();
|
$oParams = new ParameterParser();
|
||||||
|
|
||||||
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
|
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
|
||||||
$bAsKML = $oParams->getBool('polygon_kml');
|
$bAsKML = $oParams->getBool('polygon_kml');
|
||||||
$bAsSVG = $oParams->getBool('polygon_svg');
|
$bAsSVG = $oParams->getBool('polygon_svg');
|
||||||
$bAsText = $oParams->getBool('polygon_text');
|
$bAsText = $oParams->getBool('polygon_text');
|
||||||
if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
|
if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
|
||||||
+ ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes)
|
+ ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes)
|
||||||
{
|
{
|
||||||
if (CONST_PolygonOutput_MaximumTypes)
|
if (CONST_PolygonOutput_MaximumTypes)
|
||||||
{
|
{
|
||||||
userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
|
userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
|
||||||
@@ -26,38 +26,38 @@
|
|||||||
{
|
{
|
||||||
userError("Polygon output is disabled");
|
userError("Polygon output is disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polygon simplification threshold (optional)
|
// Polygon simplification threshold (optional)
|
||||||
$fThreshold = $oParams->getFloat('polygon_threshold', 0.0);
|
$fThreshold = $oParams->getFloat('polygon_threshold', 0.0);
|
||||||
|
|
||||||
// Format for output
|
// Format for output
|
||||||
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'xml');
|
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'xml');
|
||||||
|
|
||||||
// Preferred language
|
// Preferred language
|
||||||
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
|
|
||||||
$hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
$hLog = logStart($oDB, 'reverse', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
|
||||||
|
|
||||||
|
|
||||||
$oPlaceLookup = new PlaceLookup($oDB);
|
$oPlaceLookup = new PlaceLookup($oDB);
|
||||||
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
|
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
|
||||||
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
|
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
|
||||||
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
|
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
|
||||||
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
|
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
|
||||||
|
|
||||||
$sOsmType = $oParams->getSet('osm_type', array('N', 'W', 'R'));
|
$sOsmType = $oParams->getSet('osm_type', array('N', 'W', 'R'));
|
||||||
$iOsmId = $oParams->getInt('osm_id', -1);
|
$iOsmId = $oParams->getInt('osm_id', -1);
|
||||||
$fLat = $oParams->getFloat('lat');
|
$fLat = $oParams->getFloat('lat');
|
||||||
$fLon = $oParams->getFloat('lon');
|
$fLon = $oParams->getFloat('lon');
|
||||||
if ($sOsmType && $iOsmId > 0)
|
if ($sOsmType && $iOsmId > 0)
|
||||||
{
|
{
|
||||||
$aPlace = $oPlaceLookup->lookupOSMID($sOsmType, $iOsmId);
|
$aPlace = $oPlaceLookup->lookupOSMID($sOsmType, $iOsmId);
|
||||||
}
|
}
|
||||||
else if ($fLat !== false && $fLon !== false)
|
else if ($fLat !== false && $fLon !== false)
|
||||||
{
|
{
|
||||||
$oReverseGeocode = new ReverseGeocode($oDB);
|
$oReverseGeocode = new ReverseGeocode($oDB);
|
||||||
$oReverseGeocode->setZoom($oParams->getInt('zoom', 18));
|
$oReverseGeocode->setZoom($oParams->getInt('zoom', 18));
|
||||||
|
|
||||||
@@ -66,14 +66,14 @@
|
|||||||
|
|
||||||
$aPlace = $oPlaceLookup->lookup((int)$aLookup['place_id'],
|
$aPlace = $oPlaceLookup->lookup((int)$aLookup['place_id'],
|
||||||
$aLookup['type'], $aLookup['fraction']);
|
$aLookup['type'], $aLookup['fraction']);
|
||||||
}
|
}
|
||||||
else if ($sOutputFormat != 'html')
|
else if ($sOutputFormat != 'html')
|
||||||
{
|
{
|
||||||
userError("Need coordinates or OSM object to lookup.");
|
userError("Need coordinates or OSM object to lookup.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aPlace)
|
if ($aPlace)
|
||||||
{
|
{
|
||||||
$oPlaceLookup->setIncludePolygonAsPoints(false);
|
$oPlaceLookup->setIncludePolygonAsPoints(false);
|
||||||
$oPlaceLookup->setIncludePolygonAsText($bAsText);
|
$oPlaceLookup->setIncludePolygonAsText($bAsText);
|
||||||
$oPlaceLookup->setIncludePolygonAsGeoJSON($bAsGeoJSON);
|
$oPlaceLookup->setIncludePolygonAsGeoJSON($bAsGeoJSON);
|
||||||
@@ -90,19 +90,19 @@
|
|||||||
{
|
{
|
||||||
$aPlace = array_merge($aPlace, $aOutlineResult);
|
$aPlace = array_merge($aPlace, $aOutlineResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CONST_Debug)
|
if (CONST_Debug)
|
||||||
{
|
{
|
||||||
var_dump($aPlace);
|
var_dump($aPlace);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sOutputFormat=='html')
|
if ($sOutputFormat=='html')
|
||||||
{
|
{
|
||||||
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
||||||
$sTileURL = CONST_Map_Tile_URL;
|
$sTileURL = CONST_Map_Tile_URL;
|
||||||
$sTileAttribution = CONST_Map_Tile_Attribution;
|
$sTileAttribution = CONST_Map_Tile_Attribution;
|
||||||
}
|
}
|
||||||
include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php');
|
include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php');
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Search');
|
@define('CONST_ConnectionBucket_PageType', 'Search');
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/Geocode.php');
|
require_once(CONST_BasePath.'/lib/Geocode.php');
|
||||||
require_once(CONST_BasePath.'/lib/output.php');
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
$oParams = new ParameterParser();
|
$oParams = new ParameterParser();
|
||||||
|
|
||||||
$oGeocode = new Geocode($oDB);
|
$oGeocode = new Geocode($oDB);
|
||||||
|
|
||||||
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
$aLangPrefOrder = $oParams->getPreferredLanguages();
|
||||||
$oGeocode->setLanguagePreference($aLangPrefOrder);
|
$oGeocode->setLanguagePreference($aLangPrefOrder);
|
||||||
|
|
||||||
if (CONST_Search_ReversePlanForAll
|
if (CONST_Search_ReversePlanForAll
|
||||||
|| isset($aLangPrefOrder['name:de'])
|
|| isset($aLangPrefOrder['name:de'])
|
||||||
|| isset($aLangPrefOrder['name:ru'])
|
|| isset($aLangPrefOrder['name:ru'])
|
||||||
|| isset($aLangPrefOrder['name:ja'])
|
|| isset($aLangPrefOrder['name:ja'])
|
||||||
|| isset($aLangPrefOrder['name:pl']))
|
|| isset($aLangPrefOrder['name:pl']))
|
||||||
{
|
{
|
||||||
$oGeocode->setReverseInPlan(true);
|
$oGeocode->setReverseInPlan(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format for output
|
// Format for output
|
||||||
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
|
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
|
||||||
|
|
||||||
// Show / use polygons
|
// Show / use polygons
|
||||||
if ($sOutputFormat == 'html')
|
if ($sOutputFormat == 'html')
|
||||||
{
|
{
|
||||||
$oGeocode->setIncludePolygonAsText($oParams->getBool('polygon'));
|
$oGeocode->setIncludePolygonAsText($oParams->getBool('polygon'));
|
||||||
$bAsText = false;
|
$bAsText = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bAsPoints = $oParams->getBool('polygon');
|
$bAsPoints = $oParams->getBool('polygon');
|
||||||
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
|
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
|
||||||
$bAsKML = $oParams->getBool('polygon_kml');
|
$bAsKML = $oParams->getBool('polygon_kml');
|
||||||
@@ -63,15 +63,15 @@
|
|||||||
$oGeocode->setIncludePolygonAsGeoJSON($bAsGeoJSON);
|
$oGeocode->setIncludePolygonAsGeoJSON($bAsGeoJSON);
|
||||||
$oGeocode->setIncludePolygonAsKML($bAsKML);
|
$oGeocode->setIncludePolygonAsKML($bAsKML);
|
||||||
$oGeocode->setIncludePolygonAsSVG($bAsSVG);
|
$oGeocode->setIncludePolygonAsSVG($bAsSVG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polygon simplification threshold (optional)
|
// Polygon simplification threshold (optional)
|
||||||
$oGeocode->setPolygonSimplificationThreshold($oParams->getFloat('polygon_threshold', 0.0));
|
$oGeocode->setPolygonSimplificationThreshold($oParams->getFloat('polygon_threshold', 0.0));
|
||||||
|
|
||||||
$oGeocode->loadParamArray($oParams);
|
$oGeocode->loadParamArray($oParams);
|
||||||
|
|
||||||
if (CONST_Search_BatchMode && isset($_GET['batch']))
|
if (CONST_Search_BatchMode && isset($_GET['batch']))
|
||||||
{
|
{
|
||||||
$aBatch = json_decode($_GET['batch'], true);
|
$aBatch = json_decode($_GET['batch'], true);
|
||||||
$aBatchResults = array();
|
$aBatchResults = array();
|
||||||
foreach($aBatch as $aBatchParams)
|
foreach($aBatch as $aBatchParams)
|
||||||
@@ -85,13 +85,13 @@
|
|||||||
}
|
}
|
||||||
include(CONST_BasePath.'/lib/template/search-batch-json.php');
|
include(CONST_BasePath.'/lib/template/search-batch-json.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oGeocode->setQueryFromParams($oParams);
|
$oGeocode->setQueryFromParams($oParams);
|
||||||
|
|
||||||
if (!$oGeocode->getQueryString()
|
if (!$oGeocode->getQueryString()
|
||||||
&& isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
|
&& isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
|
||||||
{
|
{
|
||||||
$sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
|
$sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
|
||||||
|
|
||||||
// reverse order of '/' separated string
|
// reverse order of '/' separated string
|
||||||
@@ -99,34 +99,34 @@
|
|||||||
$aPhrases = array_reverse($aPhrases);
|
$aPhrases = array_reverse($aPhrases);
|
||||||
$sQuery = join(', ',$aPhrases);
|
$sQuery = join(', ',$aPhrases);
|
||||||
$oGeocode->setQuery($sQuery);
|
$oGeocode->setQuery($sQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
$hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
|
$hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
|
||||||
|
|
||||||
$aSearchResults = $oGeocode->lookup();
|
$aSearchResults = $oGeocode->lookup();
|
||||||
if ($aSearchResults === false) $aSearchResults = array();
|
if ($aSearchResults === false) $aSearchResults = array();
|
||||||
|
|
||||||
if ($sOutputFormat=='html')
|
if ($sOutputFormat=='html')
|
||||||
{
|
{
|
||||||
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
$sDataDate = chksql($oDB->getOne("select TO_CHAR(lastimportdate - '2 minutes'::interval,'YYYY/MM/DD HH24:MI')||' GMT' from import_status limit 1"));
|
||||||
}
|
}
|
||||||
logEnd($oDB, $hLog, sizeof($aSearchResults));
|
logEnd($oDB, $hLog, sizeof($aSearchResults));
|
||||||
|
|
||||||
$sQuery = $oGeocode->getQueryString();
|
$sQuery = $oGeocode->getQueryString();
|
||||||
$sViewBox = $oGeocode->getViewBoxString();
|
$sViewBox = $oGeocode->getViewBoxString();
|
||||||
$bShowPolygons = (isset($_GET['polygon']) && $_GET['polygon']);
|
$bShowPolygons = (isset($_GET['polygon']) && $_GET['polygon']);
|
||||||
$aExcludePlaceIDs = $oGeocode->getExcludedPlaceIDs();
|
$aExcludePlaceIDs = $oGeocode->getExcludedPlaceIDs();
|
||||||
|
|
||||||
$sMoreURL = CONST_Website_BaseURL.'search.php?format='.urlencode($sOutputFormat).'&exclude_place_ids='.join(',',$aExcludePlaceIDs);
|
$sMoreURL = CONST_Website_BaseURL.'search.php?format='.urlencode($sOutputFormat).'&exclude_place_ids='.join(',',$aExcludePlaceIDs);
|
||||||
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) $sMoreURL .= '&accept-language='.$_SERVER["HTTP_ACCEPT_LANGUAGE"];
|
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) $sMoreURL .= '&accept-language='.$_SERVER["HTTP_ACCEPT_LANGUAGE"];
|
||||||
if ($bShowPolygons) $sMoreURL .= '&polygon=1';
|
if ($bShowPolygons) $sMoreURL .= '&polygon=1';
|
||||||
if ($oGeocode->getIncludeAddressDetails()) $sMoreURL .= '&addressdetails=1';
|
if ($oGeocode->getIncludeAddressDetails()) $sMoreURL .= '&addressdetails=1';
|
||||||
if ($oGeocode->getIncludeExtraTags()) $sMoreURL .= '&extratags=1';
|
if ($oGeocode->getIncludeExtraTags()) $sMoreURL .= '&extratags=1';
|
||||||
if ($oGeocode->getIncludeNameDetails()) $sMoreURL .= '&namedetails=1';
|
if ($oGeocode->getIncludeNameDetails()) $sMoreURL .= '&namedetails=1';
|
||||||
if ($sViewBox) $sMoreURL .= '&viewbox='.urlencode($sViewBox);
|
if ($sViewBox) $sMoreURL .= '&viewbox='.urlencode($sViewBox);
|
||||||
if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon'];
|
if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon'];
|
||||||
$sMoreURL .= '&q='.urlencode($sQuery);
|
$sMoreURL .= '&q='.urlencode($sQuery);
|
||||||
|
|
||||||
if (CONST_Debug) exit;
|
if (CONST_Debug) exit;
|
||||||
|
|
||||||
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');
|
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
@define('CONST_ConnectionBucket_PageType', 'Status');
|
@define('CONST_ConnectionBucket_PageType', 'Status');
|
||||||
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
|
|
||||||
function statusError($sMsg)
|
function statusError($sMsg)
|
||||||
{
|
{
|
||||||
header("HTTP/1.0 500 Internal Server Error");
|
header("HTTP/1.0 500 Internal Server Error");
|
||||||
echo "ERROR: ".$sMsg;
|
echo "ERROR: ".$sMsg;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB =& DB::connect(CONST_Database_DSN, false);
|
$oDB =& DB::connect(CONST_Database_DSN, false);
|
||||||
if (!$oDB || PEAR::isError($oDB))
|
if (!$oDB || PEAR::isError($oDB))
|
||||||
{
|
{
|
||||||
statusError("No database");
|
statusError("No database");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sStandardWord = $oDB->getOne("select make_standard_name('a')");
|
$sStandardWord = $oDB->getOne("select make_standard_name('a')");
|
||||||
if (PEAR::isError($sStandardWord))
|
if (PEAR::isError($sStandardWord))
|
||||||
{
|
{
|
||||||
statusError("Module failed");
|
statusError("Module failed");
|
||||||
}
|
}
|
||||||
if ($sStandardWord != 'a')
|
if ($sStandardWord != 'a')
|
||||||
{
|
{
|
||||||
statusError("Module call failed");
|
statusError("Module call failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
$iWordID = $oDB->getOne("select word_id,word_token, word, class, type, country_code, operator, search_name_count from word where word_token in (' a')");
|
$iWordID = $oDB->getOne("select word_id,word_token, word, class, type, country_code, operator, search_name_count from word where word_token in (' a')");
|
||||||
if (PEAR::isError($iWordID))
|
if (PEAR::isError($iWordID))
|
||||||
{
|
{
|
||||||
statusError("Query failed");
|
statusError("Query failed");
|
||||||
}
|
}
|
||||||
if (!$iWordID)
|
if (!$iWordID)
|
||||||
{
|
{
|
||||||
statusError("No value");
|
statusError("No value");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "OK";
|
echo "OK";
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
for($iTimestamp = mktime(0, 0, 0, 5, 1, 2013); $iTimestamp < mktime(0, 0, 0, 6, 15, 2013); $iTimestamp += 24*60*60)
|
for($iTimestamp = mktime(0, 0, 0, 5, 1, 2013); $iTimestamp < mktime(0, 0, 0, 6, 15, 2013); $iTimestamp += 24*60*60)
|
||||||
{
|
{
|
||||||
$sYear = date("Y", $iTimestamp);
|
$sYear = date("Y", $iTimestamp);
|
||||||
$sMonth = date("Y-m", $iTimestamp);
|
$sMonth = date("Y-m", $iTimestamp);
|
||||||
$sDay = date("Ymd", $iTimestamp);
|
$sDay = date("Ymd", $iTimestamp);
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
@unlink("totals.txt");
|
@unlink("totals.txt");
|
||||||
rename("newtotals.txt", "totals.txt");
|
rename("newtotals.txt", "totals.txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notes:
|
// Notes:
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user