tabs-to-spaces

This commit is contained in:
Marc Tobias Metten 2016-09-04 03:19:48 +02:00
parent cd6dcfa574
commit 832547f192
55 changed files with 8236 additions and 8232 deletions

View File

@ -1,9 +1,9 @@
<?php
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
class Geocode
{
class Geocode
{
protected $oDB;
protected $aLangPrefOrder = array();
@ -1837,5 +1837,5 @@
} // end lookup()
} // end class
} // end class

View File

@ -1,6 +1,7 @@
<?php
class PlaceLookup
{
class PlaceLookup
{
protected $oDB;
protected $aLangPrefOrder = array();
@ -357,5 +358,4 @@
}
return $aOutlineResult;
}
}
?>
}

View File

@ -1,6 +1,7 @@
<?php
class ReverseGeocode
{
class ReverseGeocode
{
protected $oDB;
protected $iMaxRank = 28;
@ -209,5 +210,4 @@
'fraction' => ($bPlaceIsTiger || $bPlaceIsLine) ? $fFraction : -1);
}
}
?>
}

View File

@ -1,7 +1,7 @@
<?php
function getCmdOpt($aArg, $aSpec, &$aResult, $bExitOnError = false, $bExitOnUnknown = false)
{
function getCmdOpt($aArg, $aSpec, &$aResult, $bExitOnError = false, $bExitOnUnknown = false)
{
$aQuick = array();
$aCounts = array();
@ -108,10 +108,10 @@
}
}
return $bUnknown;
}
}
function showUsage($aSpec, $bExit = false, $sError = false)
{
function showUsage($aSpec, $bExit = false, $sError = false)
{
if ($sError)
{
echo basename($_SERVER['argv'][0]).': '.$sError."\n";
@ -142,14 +142,14 @@
}
echo "\n";
exit;
}
}
function chksql($oSql, $sMsg = false)
{
function chksql($oSql, $sMsg = false)
{
if (PEAR::isError($oSql))
{
fail($sMsg || $oSql->getMessage(), $oSql->userinfo);
}
return $oSql;
}
}

View File

@ -1,8 +1,9 @@
<?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
$oDB = chksql(DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent),
"Failed to establish database connection");
@ -12,23 +13,23 @@
$iMaxExecution = ini_get('max_execution_time') * 1000;
if ($iMaxExecution > 0) $oDB->query("SET statement_timeout TO $iMaxExecution");
return $oDB;
}
}
function getDBQuoted($s)
{
function getDBQuoted($s)
{
return "'".pg_escape_string($s)."'";
}
}
function getPostgresVersion(&$oDB)
{
function getPostgresVersion(&$oDB)
{
$sVersionString = $oDB->getOne('select version()');
preg_match('#PostgreSQL ([0-9]+)[.]([0-9]+)[^0-9]#', $sVersionString, $aMatches);
return (float) ($aMatches[1].'.'.$aMatches[2]);
}
}
function getPostgisVersion(&$oDB)
{
function getPostgisVersion(&$oDB)
{
$sVersionString = $oDB->getOne('select postgis_full_version()');
preg_match('#POSTGIS="([0-9]+)[.]([0-9]+)[.]([0-9]+)( r([0-9]+))?"#', $sVersionString, $aMatches);
return (float) ($aMatches[1].'.'.$aMatches[2]);
}
}

View File

@ -1,9 +1,10 @@
<?php
require_once('init.php');
require_once('cmd.php');
// handle http proxy when using file_get_contents
if (CONST_HTTP_Proxy) {
require_once('init.php');
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;
$aHeaders = array();
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);
}
}

View File

@ -1,14 +1,16 @@
<?php
require_once('init.php');
require_once('ParameterParser.php');
require_once('init.php');
require_once('ParameterParser.php');
/***************************************************************************
*
* Error handling functions
*
*/
function chksql($oSql, $sMsg = "Database request failed")
{
function chksql($oSql, $sMsg = "Database request failed")
{
if (!PEAR::isError($oSql)) return $oSql;
header('HTTP/1.0 500 Internal Server Error');
@ -17,7 +19,7 @@
$sSqlError = $oSql->getMessage();
echo <<<INTERNALFAIL
<html>
<html>
<head><title>Internal Server Error</title></head>
<body>
<h1>Internal Server Error</h1>
@ -43,10 +45,10 @@ INTERNALFAIL;
echo "</pre></p></body></html>";
exit;
}
}
function failInternalError($sError, $sSQL = false, $vDumpVar = false)
{
function failInternalError($sError, $sSQL = false, $vDumpVar = false)
{
header('HTTP/1.0 500 Internal Server Error');
header('Content-type: text/html; charset=utf-8');
echo "<html><body><h1>Internal Server Error</h1>";
@ -69,11 +71,11 @@ INTERNALFAIL;
}
echo "\n</body></html>\n";
exit;
}
}
function userError($sError)
{
function userError($sError)
{
header('HTTP/1.0 400 Bad Request');
header('Content-type: text/html; charset=utf-8');
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 "\n</body></html>\n";
exit;
}
}
/***************************************************************************
* HTTP Reply header setup
*/
if (CONST_NoAccessControl)
{
if (CONST_NoAccessControl)
{
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: OPTIONS,GET");
if (!empty($_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');

View File

@ -1,10 +1,10 @@
<?php
require_once(CONST_BasePath.'/lib/lib.php');
require_once(CONST_BasePath.'/lib/db.php');
require_once(CONST_BasePath.'/lib/lib.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";
exit;
}
}

View File

@ -1,57 +1,57 @@
<?php
function fail($sError, $sUserError = false)
{
function fail($sError, $sUserError = false)
{
if (!$sUserError) $sUserError = $sError;
error_log('ERROR: '.$sError);
echo $sUserError."\n";
exit(-1);
}
}
function getProcessorCount()
{
function getProcessorCount()
{
$sCPU = file_get_contents('/proc/cpuinfo');
preg_match_all('#processor\s+: [0-9]+#', $sCPU, $aMatches);
return sizeof($aMatches[0]);
}
}
function getTotalMemoryMB()
{
function getTotalMemoryMB()
{
$sCPU = file_get_contents('/proc/meminfo');
preg_match('#MemTotal: +([0-9]+) kB#', $sCPU, $aMatches);
return (int)($aMatches[1]/1024);
}
}
function getCacheMemoryMB()
{
function getCacheMemoryMB()
{
$sCPU = file_get_contents('/proc/meminfo');
preg_match('#Cached: +([0-9]+) kB#', $sCPU, $aMatches);
return (int)($aMatches[1]/1024);
}
}
function bySearchRank($a, $b)
{
function bySearchRank($a, $b)
{
if ($a['iSearchRank'] == $b['iSearchRank'])
return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
}
}
function byImportance($a, $b)
{
function byImportance($a, $b)
{
if ($a['importance'] != $b['importance'])
return ($a['importance'] > $b['importance']?-1:1);
return ($a['foundorder'] < $b['foundorder']?-1:1);
}
}
function getWordSets($aWords, $iDepth)
{
function getWordSets($aWords, $iDepth)
{
$aResult = array(array(join(' ',$aWords)));
$sFirstToken = '';
if ($iDepth < 8) {
@ -67,10 +67,10 @@
}
}
return $aResult;
}
}
function getInverseWordSets($aWords, $iDepth)
{
function getInverseWordSets($aWords, $iDepth)
{
$aResult = array(array(join(' ',$aWords)));
$sFirstToken = '';
if ($iDepth < 8)
@ -87,11 +87,11 @@
}
}
return $aResult;
}
}
function getTokensFromSets($aSets)
{
function getTokensFromSets($aSets)
{
$aTokens = array();
foreach($aSets as $aSet)
{
@ -102,15 +102,15 @@
}
}
return $aTokens;
}
}
/*
/*
GB Postcode functions
*/
function gbPostcodeCalculate($sPostcode, $sPostcodeSector, $sPostcodeEnd, &$oDB)
{
function gbPostcodeCalculate($sPostcode, $sPostcodeSector, $sPostcodeEnd, &$oDB)
{
// 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.'\'';
$aNearPostcodes = chksql($oDB->getAll($sSQL));
@ -127,319 +127,319 @@
}
return false;
}
}
function getClassTypes()
{
function getClassTypes()
{
return array(
'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,),
'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: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,),
'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: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,),
'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,),
'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: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: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: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: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: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,),
'landuse:farm' => array('label'=>'Farm','frequency'=>1201,'icon'=>'', 'defdiameter' => 0.02,),
'place:farm' => array('label'=>'Farm','frequency'=>1162,'icon'=>'', 'defdiameter' => 0.02,),
'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,),
'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: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,),
'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: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,),
'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,),
'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: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: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: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: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: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,),
'landuse:farm' => array('label'=>'Farm','frequency'=>1201,'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' => array('label'=>'Motorway','frequency'=>4627,'icon'=>'','simplelabel'=>'Road',),
'highway:trunk' => array('label'=>'Trunk','frequency'=>23084,'icon'=>'','simplelabel'=>'Road',),
'highway:primary' => array('label'=>'Primary','frequency'=>32138,'icon'=>'','simplelabel'=>'Road',),
'highway:secondary' => array('label'=>'Secondary','frequency'=>25807,'icon'=>'','simplelabel'=>'Road',),
'highway:tertiary' => array('label'=>'Tertiary','frequency'=>29829,'icon'=>'','simplelabel'=>'Road',),
'highway:residential' => array('label'=>'Residential','frequency'=>361498,'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:service' => array('label'=>'Service','frequency'=>9963,'icon'=>'','simplelabel'=>'Road',),
'highway:track' => array('label'=>'Track','frequency'=>2565,'icon'=>'','simplelabel'=>'Road',),
'highway:road' => array('label'=>'Road','frequency'=>591,'icon'=>'','simplelabel'=>'Road',),
'highway:byway' => array('label'=>'Byway','frequency'=>346,'icon'=>'','simplelabel'=>'Road',),
'highway:bridleway' => array('label'=>'Bridleway','frequency'=>1556,'icon'=>'',),
'highway:cycleway' => array('label'=>'Cycleway','frequency'=>2419,'icon'=>'',),
'highway:pedestrian' => array('label'=>'Pedestrian','frequency'=>2757,'icon'=>'',),
'highway:footway' => array('label'=>'Footway','frequency'=>15008,'icon'=>'',),
'highway:steps' => array('label'=>'Steps','frequency'=>444,'icon'=>'','simplelabel'=>'Footway',),
'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:primary_link' => array('label'=>'Primary Link','frequency'=>313,'icon'=>'','simplelabel'=>'Road',),
'highway:motorway_junction' => array('label'=>'Motorway Junction','frequency'=>1126,'icon'=>'','simplelabel'=>'Junction',),
'highway:motorway' => array('label'=>'Motorway','frequency'=>4627,'icon'=>'','simplelabel'=>'Road',),
'highway:trunk' => array('label'=>'Trunk','frequency'=>23084,'icon'=>'','simplelabel'=>'Road',),
'highway:primary' => array('label'=>'Primary','frequency'=>32138,'icon'=>'','simplelabel'=>'Road',),
'highway:secondary' => array('label'=>'Secondary','frequency'=>25807,'icon'=>'','simplelabel'=>'Road',),
'highway:tertiary' => array('label'=>'Tertiary','frequency'=>29829,'icon'=>'','simplelabel'=>'Road',),
'highway:residential' => array('label'=>'Residential','frequency'=>361498,'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:service' => array('label'=>'Service','frequency'=>9963,'icon'=>'','simplelabel'=>'Road',),
'highway:track' => array('label'=>'Track','frequency'=>2565,'icon'=>'','simplelabel'=>'Road',),
'highway:road' => array('label'=>'Road','frequency'=>591,'icon'=>'','simplelabel'=>'Road',),
'highway:byway' => array('label'=>'Byway','frequency'=>346,'icon'=>'','simplelabel'=>'Road',),
'highway:bridleway' => array('label'=>'Bridleway','frequency'=>1556,'icon'=>'',),
'highway:cycleway' => array('label'=>'Cycleway','frequency'=>2419,'icon'=>'',),
'highway:pedestrian' => array('label'=>'Pedestrian','frequency'=>2757,'icon'=>'',),
'highway:footway' => array('label'=>'Footway','frequency'=>15008,'icon'=>'',),
'highway:steps' => array('label'=>'Steps','frequency'=>444,'icon'=>'','simplelabel'=>'Footway',),
'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:primary_link' => array('label'=>'Primary Link','frequency'=>313,'icon'=>'','simplelabel'=>'Road',),
'landuse:industrial' => array('label'=>'Industrial','frequency'=>1062,'icon'=>'',),
'landuse:residential' => array('label'=>'Residential','frequency'=>886,'icon'=>'',),
'landuse:retail' => array('label'=>'Retail','frequency'=>754,'icon'=>'',),
'landuse:commercial' => array('label'=>'Commercial','frequency'=>657,'icon'=>'',),
'landuse:industrial' => array('label'=>'Industrial','frequency'=>1062,'icon'=>'',),
'landuse:residential' => array('label'=>'Residential','frequency'=>886,'icon'=>'',),
'landuse:retail' => array('label'=>'Retail','frequency'=>754,'icon'=>'',),
'landuse:commercial' => array('label'=>'Commercial','frequency'=>657,'icon'=>'',),
'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' => 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,),
'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:bar' => array('label'=>'Bar','frequency'=>164,'icon'=>'food_bar',),
'amenity:university' => array('label'=>'University','frequency'=>607,'icon'=>'education_university',),
'tourism:museum' => array('label'=>'Museum','frequency'=>543,'icon'=>'tourist_museum',),
'amenity:arts_centre' => array('label'=>'Arts Centre','frequency'=>136,'icon'=>'tourist_art_gallery2',),
'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:attraction' => array('label'=>'Attraction','frequency'=>1463,'icon'=>'poi_point_of_interest',),
'leisure:golf_course' => array('label'=>'Golf Course','frequency'=>712,'icon'=>'sport_golf',),
'historic:castle' => array('label'=>'Castle','frequency'=>316,'icon'=>'tourist_castle',),
'amenity:hospital' => array('label'=>'Hospital','frequency'=>879,'icon'=>'health_hospital',),
'amenity:school' => array('label'=>'School','frequency'=>8192,'icon'=>'education_school',),
'amenity:theatre' => array('label'=>'Theatre','frequency'=>371,'icon'=>'tourist_theatre',),
'amenity:public_building' => array('label'=>'Public Building','frequency'=>985,'icon'=>'',),
'amenity:library' => array('label'=>'Library','frequency'=>794,'icon'=>'amenity_library',),
'amenity:townhall' => array('label'=>'Townhall','frequency'=>242,'icon'=>'',),
'amenity:community_centre' => array('label'=>'Community Centre','frequency'=>157,'icon'=>'',),
'amenity:fire_station' => array('label'=>'Fire Station','frequency'=>221,'icon'=>'amenity_firestation3',),
'amenity:police' => array('label'=>'Police','frequency'=>334,'icon'=>'amenity_police2',),
'amenity:bank' => array('label'=>'Bank','frequency'=>1248,'icon'=>'money_bank2',),
'amenity:post_office' => array('label'=>'Post Office','frequency'=>859,'icon'=>'amenity_post_office',),
'leisure:park' => array('label'=>'Park','frequency'=>2378,'icon'=>'',),
'amenity:park' => array('label'=>'Park','frequency'=>53,'icon'=>'',),
'landuse:park' => array('label'=>'Park','frequency'=>50,'icon'=>'',),
'landuse:recreation_ground' => array('label'=>'Recreation Ground','frequency'=>517,'icon'=>'',),
'tourism:hotel' => array('label'=>'Hotel','frequency'=>2150,'icon'=>'accommodation_hotel2',),
'tourism:motel' => array('label'=>'Motel','frequency'=>43,'icon'=>'',),
'amenity:cinema' => array('label'=>'Cinema','frequency'=>277,'icon'=>'tourist_cinema',),
'tourism:artwork' => array('label'=>'Artwork','frequency'=>171,'icon'=>'tourist_art_gallery2',),
'historic:archaeological_site' => array('label'=>'Archaeological Site','frequency'=>407,'icon'=>'tourist_archaeological2',),
'amenity:doctors' => array('label'=>'Doctors','frequency'=>581,'icon'=>'health_doctors',),
'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',),
'shop:supermarket' => array('label'=>'Supermarket','frequency'=>2673,'icon'=>'shopping_supermarket',),
'shop:convenience' => array('label'=>'Convenience','frequency'=>1469,'icon'=>'shopping_convenience',),
'amenity:restaurant' => array('label'=>'Restaurant','frequency'=>3179,'icon'=>'food_restaurant',),
'amenity:fast_food' => array('label'=>'Fast Food','frequency'=>2289,'icon'=>'food_fastfood',),
'amenity:cafe' => array('label'=>'Cafe','frequency'=>1780,'icon'=>'food_cafe',),
'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:fuel' => array('label'=>'Fuel','frequency'=>1308,'icon'=>'transport_fuel',),
'natural:peak' => array('label'=>'Peak','frequency'=>3212,'icon'=>'poi_peak',),
'waterway:waterfall' => array('label'=>'Waterfall','frequency'=>24,'icon'=>'',),
'natural:wood' => array('label'=>'Wood','frequency'=>1845,'icon'=>'landuse_coniferous_and_deciduous',),
'natural:water' => array('label'=>'Water','frequency'=>1790,'icon'=>'',),
'landuse:forest' => array('label'=>'Forest','frequency'=>467,'icon'=>'',),
'landuse:cemetery' => array('label'=>'Cemetery','frequency'=>463,'icon'=>'',),
'landuse:allotments' => array('label'=>'Allotments','frequency'=>408,'icon'=>'',),
'landuse:farmyard' => array('label'=>'Farmyard','frequency'=>397,'icon'=>'',),
'railway:rail' => array('label'=>'Rail','frequency'=>4894,'icon'=>'',),
'waterway:canal' => array('label'=>'Canal','frequency'=>1723,'icon'=>'',),
'waterway:river' => array('label'=>'River','frequency'=>4089,'icon'=>'',),
'waterway:stream' => array('label'=>'Stream','frequency'=>2684,'icon'=>'',),
'shop:bicycle' => array('label'=>'Bicycle','frequency'=>349,'icon'=>'shopping_bicycle',),
'shop:clothes' => array('label'=>'Clothes','frequency'=>315,'icon'=>'shopping_clothes',),
'shop:hairdresser' => array('label'=>'Hairdresser','frequency'=>312,'icon'=>'shopping_hairdresser',),
'shop:doityourself' => array('label'=>'Doityourself','frequency'=>247,'icon'=>'shopping_diy',),
'shop:estate_agent' => array('label'=>'Estate Agent','frequency'=>162,'icon'=>'shopping_estateagent2',),
'shop:car' => array('label'=>'Car','frequency'=>159,'icon'=>'shopping_car',),
'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:newsagent' => array('label'=>'Newsagent','frequency'=>132,'icon'=>'',),
'shop:bakery' => array('label'=>'Bakery','frequency'=>129,'icon'=>'shopping_bakery',),
'shop:furniture' => array('label'=>'Furniture','frequency'=>124,'icon'=>'',),
'shop:butcher' => array('label'=>'Butcher','frequency'=>105,'icon'=>'shopping_butcher',),
'shop:apparel' => array('label'=>'Apparel','frequency'=>98,'icon'=>'shopping_clothes',),
'shop:electronics' => array('label'=>'Electronics','frequency'=>96,'icon'=>'',),
'shop:department_store' => array('label'=>'Department Store','frequency'=>86,'icon'=>'',),
'shop:books' => array('label'=>'Books','frequency'=>85,'icon'=>'',),
'shop:yes' => array('label'=>'Shop','frequency'=>68,'icon'=>'',),
'shop:outdoor' => array('label'=>'Outdoor','frequency'=>67,'icon'=>'',),
'shop:mall' => array('label'=>'Mall','frequency'=>63,'icon'=>'',),
'shop:florist' => array('label'=>'Florist','frequency'=>61,'icon'=>'',),
'shop:charity' => array('label'=>'Charity','frequency'=>60,'icon'=>'',),
'shop:hardware' => array('label'=>'Hardware','frequency'=>59,'icon'=>'',),
'shop:laundry' => array('label'=>'Laundry','frequency'=>51,'icon'=>'shopping_laundrette',),
'shop:shoes' => array('label'=>'Shoes','frequency'=>49,'icon'=>'',),
'shop:beverages' => array('label'=>'Beverages','frequency'=>48,'icon'=>'shopping_alcohol',),
'shop:dry_cleaning' => array('label'=>'Dry Cleaning','frequency'=>46,'icon'=>'',),
'shop:carpet' => array('label'=>'Carpet','frequency'=>45,'icon'=>'',),
'shop:computer' => array('label'=>'Computer','frequency'=>44,'icon'=>'',),
'shop:alcohol' => array('label'=>'Alcohol','frequency'=>44,'icon'=>'shopping_alcohol',),
'shop:optician' => array('label'=>'Optician','frequency'=>55,'icon'=>'health_opticians',),
'shop:chemist' => array('label'=>'Chemist','frequency'=>42,'icon'=>'health_pharmacy',),
'shop:gallery' => array('label'=>'Gallery','frequency'=>38,'icon'=>'tourist_art_gallery2',),
'shop:mobile_phone' => array('label'=>'Mobile Phone','frequency'=>37,'icon'=>'',),
'shop:sports' => array('label'=>'Sports','frequency'=>37,'icon'=>'',),
'shop:jewelry' => array('label'=>'Jewelry','frequency'=>32,'icon'=>'shopping_jewelry',),
'shop:pet' => array('label'=>'Pet','frequency'=>29,'icon'=>'',),
'shop:beauty' => array('label'=>'Beauty','frequency'=>28,'icon'=>'',),
'shop:stationery' => array('label'=>'Stationery','frequency'=>25,'icon'=>'',),
'shop:shopping_centre' => array('label'=>'Shopping Centre','frequency'=>25,'icon'=>'',),
'shop:general' => array('label'=>'General','frequency'=>25,'icon'=>'',),
'shop:electrical' => array('label'=>'Electrical','frequency'=>25,'icon'=>'',),
'shop:toys' => array('label'=>'Toys','frequency'=>23,'icon'=>'',),
'shop:jeweller' => array('label'=>'Jeweller','frequency'=>23,'icon'=>'',),
'shop:betting' => array('label'=>'Betting','frequency'=>23,'icon'=>'',),
'shop:household' => array('label'=>'Household','frequency'=>21,'icon'=>'',),
'shop:travel_agency' => array('label'=>'Travel Agency','frequency'=>21,'icon'=>'',),
'shop:hifi' => array('label'=>'Hifi','frequency'=>21,'icon'=>'',),
'amenity:shop' => array('label'=>'Shop','frequency'=>61,'icon'=>'',),
'tourism:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
'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' => 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,),
'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:bar' => array('label'=>'Bar','frequency'=>164,'icon'=>'food_bar',),
'amenity:university' => array('label'=>'University','frequency'=>607,'icon'=>'education_university',),
'tourism:museum' => array('label'=>'Museum','frequency'=>543,'icon'=>'tourist_museum',),
'amenity:arts_centre' => array('label'=>'Arts Centre','frequency'=>136,'icon'=>'tourist_art_gallery2',),
'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:attraction' => array('label'=>'Attraction','frequency'=>1463,'icon'=>'poi_point_of_interest',),
'leisure:golf_course' => array('label'=>'Golf Course','frequency'=>712,'icon'=>'sport_golf',),
'historic:castle' => array('label'=>'Castle','frequency'=>316,'icon'=>'tourist_castle',),
'amenity:hospital' => array('label'=>'Hospital','frequency'=>879,'icon'=>'health_hospital',),
'amenity:school' => array('label'=>'School','frequency'=>8192,'icon'=>'education_school',),
'amenity:theatre' => array('label'=>'Theatre','frequency'=>371,'icon'=>'tourist_theatre',),
'amenity:public_building' => array('label'=>'Public Building','frequency'=>985,'icon'=>'',),
'amenity:library' => array('label'=>'Library','frequency'=>794,'icon'=>'amenity_library',),
'amenity:townhall' => array('label'=>'Townhall','frequency'=>242,'icon'=>'',),
'amenity:community_centre' => array('label'=>'Community Centre','frequency'=>157,'icon'=>'',),
'amenity:fire_station' => array('label'=>'Fire Station','frequency'=>221,'icon'=>'amenity_firestation3',),
'amenity:police' => array('label'=>'Police','frequency'=>334,'icon'=>'amenity_police2',),
'amenity:bank' => array('label'=>'Bank','frequency'=>1248,'icon'=>'money_bank2',),
'amenity:post_office' => array('label'=>'Post Office','frequency'=>859,'icon'=>'amenity_post_office',),
'leisure:park' => array('label'=>'Park','frequency'=>2378,'icon'=>'',),
'amenity:park' => array('label'=>'Park','frequency'=>53,'icon'=>'',),
'landuse:park' => array('label'=>'Park','frequency'=>50,'icon'=>'',),
'landuse:recreation_ground' => array('label'=>'Recreation Ground','frequency'=>517,'icon'=>'',),
'tourism:hotel' => array('label'=>'Hotel','frequency'=>2150,'icon'=>'accommodation_hotel2',),
'tourism:motel' => array('label'=>'Motel','frequency'=>43,'icon'=>'',),
'amenity:cinema' => array('label'=>'Cinema','frequency'=>277,'icon'=>'tourist_cinema',),
'tourism:artwork' => array('label'=>'Artwork','frequency'=>171,'icon'=>'tourist_art_gallery2',),
'historic:archaeological_site' => array('label'=>'Archaeological Site','frequency'=>407,'icon'=>'tourist_archaeological2',),
'amenity:doctors' => array('label'=>'Doctors','frequency'=>581,'icon'=>'health_doctors',),
'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',),
'shop:supermarket' => array('label'=>'Supermarket','frequency'=>2673,'icon'=>'shopping_supermarket',),
'shop:convenience' => array('label'=>'Convenience','frequency'=>1469,'icon'=>'shopping_convenience',),
'amenity:restaurant' => array('label'=>'Restaurant','frequency'=>3179,'icon'=>'food_restaurant',),
'amenity:fast_food' => array('label'=>'Fast Food','frequency'=>2289,'icon'=>'food_fastfood',),
'amenity:cafe' => array('label'=>'Cafe','frequency'=>1780,'icon'=>'food_cafe',),
'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:fuel' => array('label'=>'Fuel','frequency'=>1308,'icon'=>'transport_fuel',),
'natural:peak' => array('label'=>'Peak','frequency'=>3212,'icon'=>'poi_peak',),
'waterway:waterfall' => array('label'=>'Waterfall','frequency'=>24,'icon'=>'',),
'natural:wood' => array('label'=>'Wood','frequency'=>1845,'icon'=>'landuse_coniferous_and_deciduous',),
'natural:water' => array('label'=>'Water','frequency'=>1790,'icon'=>'',),
'landuse:forest' => array('label'=>'Forest','frequency'=>467,'icon'=>'',),
'landuse:cemetery' => array('label'=>'Cemetery','frequency'=>463,'icon'=>'',),
'landuse:allotments' => array('label'=>'Allotments','frequency'=>408,'icon'=>'',),
'landuse:farmyard' => array('label'=>'Farmyard','frequency'=>397,'icon'=>'',),
'railway:rail' => array('label'=>'Rail','frequency'=>4894,'icon'=>'',),
'waterway:canal' => array('label'=>'Canal','frequency'=>1723,'icon'=>'',),
'waterway:river' => array('label'=>'River','frequency'=>4089,'icon'=>'',),
'waterway:stream' => array('label'=>'Stream','frequency'=>2684,'icon'=>'',),
'shop:bicycle' => array('label'=>'Bicycle','frequency'=>349,'icon'=>'shopping_bicycle',),
'shop:clothes' => array('label'=>'Clothes','frequency'=>315,'icon'=>'shopping_clothes',),
'shop:hairdresser' => array('label'=>'Hairdresser','frequency'=>312,'icon'=>'shopping_hairdresser',),
'shop:doityourself' => array('label'=>'Doityourself','frequency'=>247,'icon'=>'shopping_diy',),
'shop:estate_agent' => array('label'=>'Estate Agent','frequency'=>162,'icon'=>'shopping_estateagent2',),
'shop:car' => array('label'=>'Car','frequency'=>159,'icon'=>'shopping_car',),
'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:newsagent' => array('label'=>'Newsagent','frequency'=>132,'icon'=>'',),
'shop:bakery' => array('label'=>'Bakery','frequency'=>129,'icon'=>'shopping_bakery',),
'shop:furniture' => array('label'=>'Furniture','frequency'=>124,'icon'=>'',),
'shop:butcher' => array('label'=>'Butcher','frequency'=>105,'icon'=>'shopping_butcher',),
'shop:apparel' => array('label'=>'Apparel','frequency'=>98,'icon'=>'shopping_clothes',),
'shop:electronics' => array('label'=>'Electronics','frequency'=>96,'icon'=>'',),
'shop:department_store' => array('label'=>'Department Store','frequency'=>86,'icon'=>'',),
'shop:books' => array('label'=>'Books','frequency'=>85,'icon'=>'',),
'shop:yes' => array('label'=>'Shop','frequency'=>68,'icon'=>'',),
'shop:outdoor' => array('label'=>'Outdoor','frequency'=>67,'icon'=>'',),
'shop:mall' => array('label'=>'Mall','frequency'=>63,'icon'=>'',),
'shop:florist' => array('label'=>'Florist','frequency'=>61,'icon'=>'',),
'shop:charity' => array('label'=>'Charity','frequency'=>60,'icon'=>'',),
'shop:hardware' => array('label'=>'Hardware','frequency'=>59,'icon'=>'',),
'shop:laundry' => array('label'=>'Laundry','frequency'=>51,'icon'=>'shopping_laundrette',),
'shop:shoes' => array('label'=>'Shoes','frequency'=>49,'icon'=>'',),
'shop:beverages' => array('label'=>'Beverages','frequency'=>48,'icon'=>'shopping_alcohol',),
'shop:dry_cleaning' => array('label'=>'Dry Cleaning','frequency'=>46,'icon'=>'',),
'shop:carpet' => array('label'=>'Carpet','frequency'=>45,'icon'=>'',),
'shop:computer' => array('label'=>'Computer','frequency'=>44,'icon'=>'',),
'shop:alcohol' => array('label'=>'Alcohol','frequency'=>44,'icon'=>'shopping_alcohol',),
'shop:optician' => array('label'=>'Optician','frequency'=>55,'icon'=>'health_opticians',),
'shop:chemist' => array('label'=>'Chemist','frequency'=>42,'icon'=>'health_pharmacy',),
'shop:gallery' => array('label'=>'Gallery','frequency'=>38,'icon'=>'tourist_art_gallery2',),
'shop:mobile_phone' => array('label'=>'Mobile Phone','frequency'=>37,'icon'=>'',),
'shop:sports' => array('label'=>'Sports','frequency'=>37,'icon'=>'',),
'shop:jewelry' => array('label'=>'Jewelry','frequency'=>32,'icon'=>'shopping_jewelry',),
'shop:pet' => array('label'=>'Pet','frequency'=>29,'icon'=>'',),
'shop:beauty' => array('label'=>'Beauty','frequency'=>28,'icon'=>'',),
'shop:stationery' => array('label'=>'Stationery','frequency'=>25,'icon'=>'',),
'shop:shopping_centre' => array('label'=>'Shopping Centre','frequency'=>25,'icon'=>'',),
'shop:general' => array('label'=>'General','frequency'=>25,'icon'=>'',),
'shop:electrical' => array('label'=>'Electrical','frequency'=>25,'icon'=>'',),
'shop:toys' => array('label'=>'Toys','frequency'=>23,'icon'=>'',),
'shop:jeweller' => array('label'=>'Jeweller','frequency'=>23,'icon'=>'',),
'shop:betting' => array('label'=>'Betting','frequency'=>23,'icon'=>'',),
'shop:household' => array('label'=>'Household','frequency'=>21,'icon'=>'',),
'shop:travel_agency' => array('label'=>'Travel Agency','frequency'=>21,'icon'=>'',),
'shop:hifi' => array('label'=>'Hifi','frequency'=>21,'icon'=>'',),
'amenity:shop' => array('label'=>'Shop','frequency'=>61,'icon'=>'',),
'tourism:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
'place:house' => 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:country_code' => array('label'=>'Country Code','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_number' => array('label'=>'House Number','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'=>'',),
'highway:unsurfaced' => array('label'=>'Unsurfaced','frequency'=>492,'icon'=>'',),
'historic:ruins' => array('label'=>'Ruins','frequency'=>483,'icon'=>'tourist_ruin',),
'amenity:college' => array('label'=>'College','frequency'=>473,'icon'=>'education_school',),
'historic:monument' => array('label'=>'Monument','frequency'=>470,'icon'=>'tourist_monument',),
'railway:subway' => array('label'=>'Subway','frequency'=>385,'icon'=>'',),
'historic:memorial' => array('label'=>'Memorial','frequency'=>382,'icon'=>'tourist_monument',),
'leisure:nature_reserve' => array('label'=>'Nature Reserve','frequency'=>342,'icon'=>'',),
'leisure:common' => array('label'=>'Common','frequency'=>322,'icon'=>'',),
'waterway:lock_gate' => array('label'=>'Lock Gate','frequency'=>321,'icon'=>'',),
'natural:fell' => array('label'=>'Fell','frequency'=>308,'icon'=>'',),
'amenity:nightclub' => array('label'=>'Nightclub','frequency'=>292,'icon'=>'',),
'highway:path' => array('label'=>'Path','frequency'=>287,'icon'=>'',),
'leisure:garden' => array('label'=>'Garden','frequency'=>285,'icon'=>'',),
'landuse:reservoir' => array('label'=>'Reservoir','frequency'=>276,'icon'=>'',),
'leisure:playground' => array('label'=>'Playground','frequency'=>264,'icon'=>'',),
'leisure:stadium' => array('label'=>'Stadium','frequency'=>212,'icon'=>'',),
'historic:mine' => array('label'=>'Mine','frequency'=>193,'icon'=>'poi_mine',),
'natural:cliff' => array('label'=>'Cliff','frequency'=>193,'icon'=>'',),
'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:kindergarten' => array('label'=>'Kindergarten','frequency'=>179,'icon'=>'',),
'highway:construction' => array('label'=>'Construction','frequency'=>176,'icon'=>'',),
'amenity:atm' => array('label'=>'Atm','frequency'=>172,'icon'=>'money_atm2',),
'amenity:emergency_phone' => array('label'=>'Emergency Phone','frequency'=>164,'icon'=>'',),
'waterway:lock' => array('label'=>'Lock','frequency'=>146,'icon'=>'',),
'waterway:riverbank' => array('label'=>'Riverbank','frequency'=>143,'icon'=>'',),
'natural:coastline' => array('label'=>'Coastline','frequency'=>142,'icon'=>'',),
'tourism:viewpoint' => array('label'=>'Viewpoint','frequency'=>140,'icon'=>'tourist_view_point',),
'tourism:hostel' => array('label'=>'Hostel','frequency'=>140,'icon'=>'',),
'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:platform' => array('label'=>'Platform','frequency'=>134,'icon'=>'',),
'railway:tram' => array('label'=>'Tram','frequency'=>130,'icon'=>'transport_tram_stop',),
'amenity:courthouse' => array('label'=>'Courthouse','frequency'=>129,'icon'=>'amenity_court',),
'amenity:recycling' => array('label'=>'Recycling','frequency'=>126,'icon'=>'amenity_recycling',),
'amenity:dentist' => array('label'=>'Dentist','frequency'=>124,'icon'=>'health_dentist',),
'natural:beach' => array('label'=>'Beach','frequency'=>121,'icon'=>'tourist_beach',),
'place:moor' => array('label'=>'Moor','frequency'=>118,'icon'=>'',),
'amenity:grave_yard' => array('label'=>'Grave Yard','frequency'=>110,'icon'=>'',),
'waterway:drain' => array('label'=>'Drain','frequency'=>108,'icon'=>'',),
'landuse:grass' => array('label'=>'Grass','frequency'=>106,'icon'=>'',),
'landuse:village_green' => array('label'=>'Village Green','frequency'=>106,'icon'=>'',),
'natural:bay' => array('label'=>'Bay','frequency'=>102,'icon'=>'',),
'railway:tram_stop' => array('label'=>'Tram Stop','frequency'=>101,'icon'=>'transport_tram_stop',),
'leisure:marina' => array('label'=>'Marina','frequency'=>98,'icon'=>'',),
'highway:stile' => array('label'=>'Stile','frequency'=>97,'icon'=>'',),
'natural:moor' => array('label'=>'Moor','frequency'=>95,'icon'=>'',),
'railway:light_rail' => array('label'=>'Light Rail','frequency'=>91,'icon'=>'',),
'railway:narrow_gauge' => array('label'=>'Narrow Gauge','frequency'=>90,'icon'=>'',),
'natural:land' => array('label'=>'Land','frequency'=>86,'icon'=>'',),
'amenity:village_hall' => array('label'=>'Village Hall','frequency'=>82,'icon'=>'',),
'waterway:dock' => array('label'=>'Dock','frequency'=>80,'icon'=>'',),
'amenity:veterinary' => array('label'=>'Veterinary','frequency'=>79,'icon'=>'',),
'landuse:brownfield' => array('label'=>'Brownfield','frequency'=>77,'icon'=>'',),
'leisure:track' => array('label'=>'Track','frequency'=>76,'icon'=>'',),
'railway:historic_station' => array('label'=>'Historic Station','frequency'=>74,'icon'=>'',),
'landuse:construction' => array('label'=>'Construction','frequency'=>72,'icon'=>'',),
'amenity:prison' => array('label'=>'Prison','frequency'=>71,'icon'=>'amenity_prison',),
'landuse:quarry' => array('label'=>'Quarry','frequency'=>71,'icon'=>'',),
'amenity:telephone' => array('label'=>'Telephone','frequency'=>70,'icon'=>'',),
'highway:traffic_signals' => array('label'=>'Traffic Signals','frequency'=>66,'icon'=>'',),
'natural:heath' => array('label'=>'Heath','frequency'=>62,'icon'=>'',),
'historic:house' => array('label'=>'House','frequency'=>61,'icon'=>'',),
'amenity:social_club' => array('label'=>'Social Club','frequency'=>61,'icon'=>'',),
'landuse:military' => array('label'=>'Military','frequency'=>61,'icon'=>'',),
'amenity:health_centre' => array('label'=>'Health Centre','frequency'=>59,'icon'=>'',),
'historic:building' => array('label'=>'Building','frequency'=>58,'icon'=>'',),
'amenity:clinic' => array('label'=>'Clinic','frequency'=>57,'icon'=>'',),
'highway:services' => array('label'=>'Services','frequency'=>56,'icon'=>'',),
'amenity:ferry_terminal' => array('label'=>'Ferry Terminal','frequency'=>55,'icon'=>'',),
'natural:marsh' => array('label'=>'Marsh','frequency'=>55,'icon'=>'',),
'natural:hill' => array('label'=>'Hill','frequency'=>54,'icon'=>'',),
'highway:raceway' => array('label'=>'Raceway','frequency'=>53,'icon'=>'',),
'amenity:taxi' => array('label'=>'Taxi','frequency'=>47,'icon'=>'',),
'amenity:take_away' => array('label'=>'Take Away','frequency'=>45,'icon'=>'',),
'amenity:car_rental' => array('label'=>'Car Rental','frequency'=>44,'icon'=>'',),
'place:islet' => array('label'=>'Islet','frequency'=>44,'icon'=>'',),
'amenity:nursery' => array('label'=>'Nursery','frequency'=>44,'icon'=>'',),
'amenity:nursing_home' => array('label'=>'Nursing Home','frequency'=>43,'icon'=>'',),
'amenity:toilets' => array('label'=>'Toilets','frequency'=>38,'icon'=>'',),
'amenity:hall' => array('label'=>'Hall','frequency'=>38,'icon'=>'',),
'waterway:boatyard' => array('label'=>'Boatyard','frequency'=>36,'icon'=>'',),
'highway:mini_roundabout' => array('label'=>'Mini Roundabout','frequency'=>35,'icon'=>'',),
'historic:manor' => array('label'=>'Manor','frequency'=>35,'icon'=>'',),
'tourism:chalet' => array('label'=>'Chalet','frequency'=>34,'icon'=>'',),
'amenity:bicycle_parking' => array('label'=>'Bicycle Parking','frequency'=>34,'icon'=>'',),
'amenity:hotel' => array('label'=>'Hotel','frequency'=>34,'icon'=>'',),
'waterway:weir' => array('label'=>'Weir','frequency'=>33,'icon'=>'',),
'natural:wetland' => array('label'=>'Wetland','frequency'=>33,'icon'=>'',),
'natural:cave_entrance' => array('label'=>'Cave Entrance','frequency'=>32,'icon'=>'',),
'amenity:crematorium' => array('label'=>'Crematorium','frequency'=>31,'icon'=>'',),
'tourism:picnic_site' => array('label'=>'Picnic Site','frequency'=>31,'icon'=>'',),
'landuse:wood' => array('label'=>'Wood','frequency'=>30,'icon'=>'',),
'landuse:basin' => array('label'=>'Basin','frequency'=>30,'icon'=>'',),
'natural:tree' => array('label'=>'Tree','frequency'=>30,'icon'=>'',),
'leisure:slipway' => array('label'=>'Slipway','frequency'=>29,'icon'=>'',),
'landuse:meadow' => array('label'=>'Meadow','frequency'=>29,'icon'=>'',),
'landuse:piste' => array('label'=>'Piste','frequency'=>28,'icon'=>'',),
'amenity:care_home' => array('label'=>'Care Home','frequency'=>28,'icon'=>'',),
'amenity:club' => array('label'=>'Club','frequency'=>28,'icon'=>'',),
'amenity:medical_centre' => array('label'=>'Medical Centre','frequency'=>27,'icon'=>'',),
'historic:roman_road' => array('label'=>'Roman Road','frequency'=>27,'icon'=>'',),
'historic:fort' => array('label'=>'Fort','frequency'=>26,'icon'=>'',),
'railway:subway_entrance' => array('label'=>'Subway Entrance','frequency'=>26,'icon'=>'',),
'historic:yes' => array('label'=>'Historic','frequency'=>25,'icon'=>'',),
'highway:gate' => array('label'=>'Gate','frequency'=>25,'icon'=>'',),
'leisure:fishing' => array('label'=>'Fishing','frequency'=>24,'icon'=>'',),
'historic:museum' => array('label'=>'Museum','frequency'=>24,'icon'=>'',),
'amenity:car_wash' => array('label'=>'Car Wash','frequency'=>24,'icon'=>'',),
'railway:level_crossing' => array('label'=>'Level Crossing','frequency'=>23,'icon'=>'',),
'leisure:bird_hide' => array('label'=>'Bird Hide','frequency'=>23,'icon'=>'',),
'natural:headland' => array('label'=>'Headland','frequency'=>21,'icon'=>'',),
'tourism:apartments' => array('label'=>'Apartments','frequency'=>21,'icon'=>'',),
'amenity:shopping' => array('label'=>'Shopping','frequency'=>21,'icon'=>'',),
'natural:scrub' => array('label'=>'Scrub','frequency'=>20,'icon'=>'',),
'natural:fen' => array('label'=>'Fen','frequency'=>20,'icon'=>'',),
'building:yes' => array('label'=>'Building','frequency'=>200,'icon'=>'',),
'mountain_pass:yes' => array('label'=>'Mountain Pass','frequency'=>200,'icon'=>'',),
'leisure:pitch' => array('label'=>'Pitch','frequency'=>762,'icon'=>'',),
'highway:unsurfaced' => array('label'=>'Unsurfaced','frequency'=>492,'icon'=>'',),
'historic:ruins' => array('label'=>'Ruins','frequency'=>483,'icon'=>'tourist_ruin',),
'amenity:college' => array('label'=>'College','frequency'=>473,'icon'=>'education_school',),
'historic:monument' => array('label'=>'Monument','frequency'=>470,'icon'=>'tourist_monument',),
'railway:subway' => array('label'=>'Subway','frequency'=>385,'icon'=>'',),
'historic:memorial' => array('label'=>'Memorial','frequency'=>382,'icon'=>'tourist_monument',),
'leisure:nature_reserve' => array('label'=>'Nature Reserve','frequency'=>342,'icon'=>'',),
'leisure:common' => array('label'=>'Common','frequency'=>322,'icon'=>'',),
'waterway:lock_gate' => array('label'=>'Lock Gate','frequency'=>321,'icon'=>'',),
'natural:fell' => array('label'=>'Fell','frequency'=>308,'icon'=>'',),
'amenity:nightclub' => array('label'=>'Nightclub','frequency'=>292,'icon'=>'',),
'highway:path' => array('label'=>'Path','frequency'=>287,'icon'=>'',),
'leisure:garden' => array('label'=>'Garden','frequency'=>285,'icon'=>'',),
'landuse:reservoir' => array('label'=>'Reservoir','frequency'=>276,'icon'=>'',),
'leisure:playground' => array('label'=>'Playground','frequency'=>264,'icon'=>'',),
'leisure:stadium' => array('label'=>'Stadium','frequency'=>212,'icon'=>'',),
'historic:mine' => array('label'=>'Mine','frequency'=>193,'icon'=>'poi_mine',),
'natural:cliff' => array('label'=>'Cliff','frequency'=>193,'icon'=>'',),
'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:kindergarten' => array('label'=>'Kindergarten','frequency'=>179,'icon'=>'',),
'highway:construction' => array('label'=>'Construction','frequency'=>176,'icon'=>'',),
'amenity:atm' => array('label'=>'Atm','frequency'=>172,'icon'=>'money_atm2',),
'amenity:emergency_phone' => array('label'=>'Emergency Phone','frequency'=>164,'icon'=>'',),
'waterway:lock' => array('label'=>'Lock','frequency'=>146,'icon'=>'',),
'waterway:riverbank' => array('label'=>'Riverbank','frequency'=>143,'icon'=>'',),
'natural:coastline' => array('label'=>'Coastline','frequency'=>142,'icon'=>'',),
'tourism:viewpoint' => array('label'=>'Viewpoint','frequency'=>140,'icon'=>'tourist_view_point',),
'tourism:hostel' => array('label'=>'Hostel','frequency'=>140,'icon'=>'',),
'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:platform' => array('label'=>'Platform','frequency'=>134,'icon'=>'',),
'railway:tram' => array('label'=>'Tram','frequency'=>130,'icon'=>'transport_tram_stop',),
'amenity:courthouse' => array('label'=>'Courthouse','frequency'=>129,'icon'=>'amenity_court',),
'amenity:recycling' => array('label'=>'Recycling','frequency'=>126,'icon'=>'amenity_recycling',),
'amenity:dentist' => array('label'=>'Dentist','frequency'=>124,'icon'=>'health_dentist',),
'natural:beach' => array('label'=>'Beach','frequency'=>121,'icon'=>'tourist_beach',),
'place:moor' => array('label'=>'Moor','frequency'=>118,'icon'=>'',),
'amenity:grave_yard' => array('label'=>'Grave Yard','frequency'=>110,'icon'=>'',),
'waterway:drain' => array('label'=>'Drain','frequency'=>108,'icon'=>'',),
'landuse:grass' => array('label'=>'Grass','frequency'=>106,'icon'=>'',),
'landuse:village_green' => array('label'=>'Village Green','frequency'=>106,'icon'=>'',),
'natural:bay' => array('label'=>'Bay','frequency'=>102,'icon'=>'',),
'railway:tram_stop' => array('label'=>'Tram Stop','frequency'=>101,'icon'=>'transport_tram_stop',),
'leisure:marina' => array('label'=>'Marina','frequency'=>98,'icon'=>'',),
'highway:stile' => array('label'=>'Stile','frequency'=>97,'icon'=>'',),
'natural:moor' => array('label'=>'Moor','frequency'=>95,'icon'=>'',),
'railway:light_rail' => array('label'=>'Light Rail','frequency'=>91,'icon'=>'',),
'railway:narrow_gauge' => array('label'=>'Narrow Gauge','frequency'=>90,'icon'=>'',),
'natural:land' => array('label'=>'Land','frequency'=>86,'icon'=>'',),
'amenity:village_hall' => array('label'=>'Village Hall','frequency'=>82,'icon'=>'',),
'waterway:dock' => array('label'=>'Dock','frequency'=>80,'icon'=>'',),
'amenity:veterinary' => array('label'=>'Veterinary','frequency'=>79,'icon'=>'',),
'landuse:brownfield' => array('label'=>'Brownfield','frequency'=>77,'icon'=>'',),
'leisure:track' => array('label'=>'Track','frequency'=>76,'icon'=>'',),
'railway:historic_station' => array('label'=>'Historic Station','frequency'=>74,'icon'=>'',),
'landuse:construction' => array('label'=>'Construction','frequency'=>72,'icon'=>'',),
'amenity:prison' => array('label'=>'Prison','frequency'=>71,'icon'=>'amenity_prison',),
'landuse:quarry' => array('label'=>'Quarry','frequency'=>71,'icon'=>'',),
'amenity:telephone' => array('label'=>'Telephone','frequency'=>70,'icon'=>'',),
'highway:traffic_signals' => array('label'=>'Traffic Signals','frequency'=>66,'icon'=>'',),
'natural:heath' => array('label'=>'Heath','frequency'=>62,'icon'=>'',),
'historic:house' => array('label'=>'House','frequency'=>61,'icon'=>'',),
'amenity:social_club' => array('label'=>'Social Club','frequency'=>61,'icon'=>'',),
'landuse:military' => array('label'=>'Military','frequency'=>61,'icon'=>'',),
'amenity:health_centre' => array('label'=>'Health Centre','frequency'=>59,'icon'=>'',),
'historic:building' => array('label'=>'Building','frequency'=>58,'icon'=>'',),
'amenity:clinic' => array('label'=>'Clinic','frequency'=>57,'icon'=>'',),
'highway:services' => array('label'=>'Services','frequency'=>56,'icon'=>'',),
'amenity:ferry_terminal' => array('label'=>'Ferry Terminal','frequency'=>55,'icon'=>'',),
'natural:marsh' => array('label'=>'Marsh','frequency'=>55,'icon'=>'',),
'natural:hill' => array('label'=>'Hill','frequency'=>54,'icon'=>'',),
'highway:raceway' => array('label'=>'Raceway','frequency'=>53,'icon'=>'',),
'amenity:taxi' => array('label'=>'Taxi','frequency'=>47,'icon'=>'',),
'amenity:take_away' => array('label'=>'Take Away','frequency'=>45,'icon'=>'',),
'amenity:car_rental' => array('label'=>'Car Rental','frequency'=>44,'icon'=>'',),
'place:islet' => array('label'=>'Islet','frequency'=>44,'icon'=>'',),
'amenity:nursery' => array('label'=>'Nursery','frequency'=>44,'icon'=>'',),
'amenity:nursing_home' => array('label'=>'Nursing Home','frequency'=>43,'icon'=>'',),
'amenity:toilets' => array('label'=>'Toilets','frequency'=>38,'icon'=>'',),
'amenity:hall' => array('label'=>'Hall','frequency'=>38,'icon'=>'',),
'waterway:boatyard' => array('label'=>'Boatyard','frequency'=>36,'icon'=>'',),
'highway:mini_roundabout' => array('label'=>'Mini Roundabout','frequency'=>35,'icon'=>'',),
'historic:manor' => array('label'=>'Manor','frequency'=>35,'icon'=>'',),
'tourism:chalet' => array('label'=>'Chalet','frequency'=>34,'icon'=>'',),
'amenity:bicycle_parking' => array('label'=>'Bicycle Parking','frequency'=>34,'icon'=>'',),
'amenity:hotel' => array('label'=>'Hotel','frequency'=>34,'icon'=>'',),
'waterway:weir' => array('label'=>'Weir','frequency'=>33,'icon'=>'',),
'natural:wetland' => array('label'=>'Wetland','frequency'=>33,'icon'=>'',),
'natural:cave_entrance' => array('label'=>'Cave Entrance','frequency'=>32,'icon'=>'',),
'amenity:crematorium' => array('label'=>'Crematorium','frequency'=>31,'icon'=>'',),
'tourism:picnic_site' => array('label'=>'Picnic Site','frequency'=>31,'icon'=>'',),
'landuse:wood' => array('label'=>'Wood','frequency'=>30,'icon'=>'',),
'landuse:basin' => array('label'=>'Basin','frequency'=>30,'icon'=>'',),
'natural:tree' => array('label'=>'Tree','frequency'=>30,'icon'=>'',),
'leisure:slipway' => array('label'=>'Slipway','frequency'=>29,'icon'=>'',),
'landuse:meadow' => array('label'=>'Meadow','frequency'=>29,'icon'=>'',),
'landuse:piste' => array('label'=>'Piste','frequency'=>28,'icon'=>'',),
'amenity:care_home' => array('label'=>'Care Home','frequency'=>28,'icon'=>'',),
'amenity:club' => array('label'=>'Club','frequency'=>28,'icon'=>'',),
'amenity:medical_centre' => array('label'=>'Medical Centre','frequency'=>27,'icon'=>'',),
'historic:roman_road' => array('label'=>'Roman Road','frequency'=>27,'icon'=>'',),
'historic:fort' => array('label'=>'Fort','frequency'=>26,'icon'=>'',),
'railway:subway_entrance' => array('label'=>'Subway Entrance','frequency'=>26,'icon'=>'',),
'historic:yes' => array('label'=>'Historic','frequency'=>25,'icon'=>'',),
'highway:gate' => array('label'=>'Gate','frequency'=>25,'icon'=>'',),
'leisure:fishing' => array('label'=>'Fishing','frequency'=>24,'icon'=>'',),
'historic:museum' => array('label'=>'Museum','frequency'=>24,'icon'=>'',),
'amenity:car_wash' => array('label'=>'Car Wash','frequency'=>24,'icon'=>'',),
'railway:level_crossing' => array('label'=>'Level Crossing','frequency'=>23,'icon'=>'',),
'leisure:bird_hide' => array('label'=>'Bird Hide','frequency'=>23,'icon'=>'',),
'natural:headland' => array('label'=>'Headland','frequency'=>21,'icon'=>'',),
'tourism:apartments' => array('label'=>'Apartments','frequency'=>21,'icon'=>'',),
'amenity:shopping' => array('label'=>'Shopping','frequency'=>21,'icon'=>'',),
'natural:scrub' => array('label'=>'Scrub','frequency'=>20,'icon'=>'',),
'natural:fen' => array('label'=>'Fen','frequency'=>20,'icon'=>'',),
'building:yes' => array('label'=>'Building','frequency'=>200,'icon'=>'',),
'mountain_pass:yes' => array('label'=>'Mountain Pass','frequency'=>200,'icon'=>'',),
'amenity:parking' => array('label'=>'Parking','frequency'=>3157,'icon'=>'',),
'highway:bus_stop' => array('label'=>'Bus Stop','frequency'=>35777,'icon'=>'transport_bus_stop2',),
'place:postcode' => array('label'=>'Postcode','frequency'=>27267,'icon'=>'',),
'amenity:post_box' => array('label'=>'Post Box','frequency'=>9613,'icon'=>'',),
'amenity:parking' => array('label'=>'Parking','frequency'=>3157,'icon'=>'',),
'highway:bus_stop' => array('label'=>'Bus Stop','frequency'=>35777,'icon'=>'transport_bus_stop2',),
'place:postcode' => array('label'=>'Postcode','frequency'=>27267,'icon'=>'',),
'amenity:post_box' => array('label'=>'Post Box','frequency'=>9613,'icon'=>'',),
'place:houses' => array('label'=>'Houses','frequency'=>85,'icon'=>'',),
'railway:preserved' => array('label'=>'Preserved','frequency'=>227,'icon'=>'',),
'waterway:derelict_canal' => array('label'=>'Derelict Canal','frequency'=>21,'icon'=>'',),
'amenity:dead_pub' => array('label'=>'Dead Pub','frequency'=>20,'icon'=>'',),
'railway:disused_station' => array('label'=>'Disused Station','frequency'=>114,'icon'=>'',),
'railway:abandoned' => array('label'=>'Abandoned','frequency'=>641,'icon'=>'',),
'railway:disused' => array('label'=>'Disused','frequency'=>72,'icon'=>'',),
'place:houses' => array('label'=>'Houses','frequency'=>85,'icon'=>'',),
'railway:preserved' => array('label'=>'Preserved','frequency'=>227,'icon'=>'',),
'waterway:derelict_canal' => array('label'=>'Derelict Canal','frequency'=>21,'icon'=>'',),
'amenity:dead_pub' => array('label'=>'Dead Pub','frequency'=>20,'icon'=>'',),
'railway:disused_station' => array('label'=>'Disused Station','frequency'=>114,'icon'=>'',),
'railway:abandoned' => array('label'=>'Abandoned','frequency'=>641,'icon'=>'',),
'railway:disused' => array('label'=>'Disused','frequency'=>72,'icon'=>'',),
);
}
}
function getClassTypesWithImportance()
{
function getClassTypesWithImportance()
{
$aOrders = getClassTypes();
$i = 1;
foreach($aOrders as $sID => $a)
@ -447,10 +447,10 @@
$aOrders[$sID]['importance'] = $i++;
}
return $aOrders;
}
}
function getResultDiameter($aResult)
{
function getResultDiameter($aResult)
{
$aClassType = getClassTypes();
$fDiameter = 0.0001;
@ -472,11 +472,11 @@
}
return $fDiameter;
}
}
function javascript_renderData($xVal, $iOptions = 0)
{
function javascript_renderData($xVal, $iOptions = 0)
{
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID > 50400)
$iOptions |= JSON_UNESCAPED_UNICODE;
$jsonout = json_encode($xVal, $iOptions);
@ -497,11 +497,11 @@
header('HTTP/1.0 400 Bad Request');
}
}
}
}
function _debugDumpGroupedSearches($aData, $aTokens)
{
function _debugDumpGroupedSearches($aData, $aTokens)
{
$aWordsIDs = array();
if ($aTokens)
{
@ -577,11 +577,11 @@
}
}
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)";
if (!$bRaw) $sSQL .= " WHERE isaddress OR type = 'country_code'";
$sSQL .= " order by rank_address desc,isaddress desc";
@ -621,25 +621,25 @@
}
}
return $aAddress;
}
}
function addQuotes($s)
{
function addQuotes($s)
{
return "'".$s."'";
}
}
// returns boolean
function validLatLon($fLat,$fLon)
{
// returns boolean
function validLatLon($fLat,$fLon)
{
return ($fLat <= 90.1 && $fLat >= -90.1 && $fLon <= 180.1 && $fLon >= -180.1);
}
}
// Do we have anything that looks like a lat/lon pair?
// returns array(lat,lon,query_with_lat_lon_removed)
// or null
function looksLikeLatLonPair($sQuery)
{
// Do we have anything that looks like a lat/lon pair?
// returns array(lat,lon,query_with_lat_lon_removed)
// or null
function looksLikeLatLonPair($sQuery)
{
$sFound = null;
$fQueryLat = null;
$fQueryLon = null;
@ -717,11 +717,11 @@
$sQuery = trim(str_replace($sFound, ' ', $sQuery));
return array('lat' => $fQueryLat, 'lon' => $fQueryLon, 'query' => $sQuery);
}
}
function geometryText2Points($geometry_as_text, $fRadius)
{
function geometryText2Points($geometry_as_text, $fRadius)
{
$aPolyPoints = NULL;
if (preg_match('#POLYGON\\(\\(([- 0-9.,]+)#', $geometry_as_text, $aMatch))
{
@ -751,10 +751,10 @@
}
return;
}
}
function createPointsAroundCenter($fLon, $fLat, $fRadius)
{
function createPointsAroundCenter($fLon, $fLat, $fRadius)
{
$iSteps = max(8, min(100, ($fRadius * 40000)^2));
$fStepSize = (2*pi())/$iSteps;
$aPolyPoints = array();
@ -763,4 +763,4 @@
$aPolyPoints[] = array('', $fLon+($fRadius*sin($f)), $fLat+($fRadius*cos($f)) );
}
return $aPolyPoints;
}
}

View File

@ -1,7 +1,7 @@
<?php
function logStart(&$oDB, $sType = '', $sQuery = '', $aLanguageList = array())
{
function logStart(&$oDB, $sType = '', $sQuery = '', $aLanguageList = array())
{
$fStartTime = microtime(true);
$aStartTime = explode('.', $fStartTime);
if (!isset($aStartTime[1])) $aStartTime[1] = '0';
@ -44,10 +44,10 @@
}
return $hLog;
}
}
function logEnd(&$oDB, $hLog, $iNumResults)
{
function logEnd(&$oDB, $hLog, $iNumResults)
{
$fEndTime = microtime(true);
if (CONST_Log_DB)
@ -71,4 +71,4 @@
file_put_contents(CONST_Log_File, $aOutdata, FILE_APPEND | LOCK_EX);
}
}
}

View File

@ -1,7 +1,7 @@
<?php
function formatOSMType($sType, $bIncludeExternal=true)
{
function formatOSMType($sType, $bIncludeExternal=true)
{
if ($sType == 'N') return 'node';
if ($sType == 'W') return 'way';
if ($sType == 'R') return 'relation';
@ -12,32 +12,32 @@
if ($sType == 'I') return 'way';
return '';
}
}
function osmLink($aFeature, $sRefText=false)
{
function osmLink($aFeature, $sRefText=false)
{
$sOSMType = formatOSMType($aFeature['osm_type'], false);
if ($sOSMType)
{
return '<a href="//www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'</a>';
}
return '';
}
}
function wikipediaLink($aFeature)
{
function wikipediaLink($aFeature)
{
if ($aFeature['wikipedia'])
{
list($sLanguage, $sArticle) = explode(':',$aFeature['wikipedia']);
return '<a href="https://'.$sLanguage.'.wikipedia.org/wiki/'.urlencode($sArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
}
return '';
}
}
function detailsLink($aFeature, $sTitle=false)
{
function detailsLink($aFeature, $sTitle=false)
{
if (!$aFeature['place_id']) return '';
return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
}
}

View File

@ -1,15 +1,16 @@
<?php
$aFilteredPlaces = array();
if (!sizeof($aPlace))
{
$aFilteredPlaces = array();
if (!sizeof($aPlace))
{
if (isset($sError))
$aFilteredPlaces['error'] = $sError;
else
$aFilteredPlaces['error'] = 'Unable to geocode';
}
else
{
}
else
{
if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$sOSMType = formatOSMType($aPlace['osm_type']);
@ -49,7 +50,7 @@
{
$aFilteredPlaces['geokml'] = $aPlace['askml'];
}
}
}
javascript_renderData($aFilteredPlaces);
javascript_renderData($aFilteredPlaces);

View File

@ -1,15 +1,16 @@
<?php
$aFilteredPlaces = array();
if (!sizeof($aPlace))
{
$aFilteredPlaces = array();
if (!sizeof($aPlace))
{
if (isset($sError))
$aFilteredPlaces['error'] = $sError;
else
$aFilteredPlaces['error'] = 'Unable to geocode';
}
else
{
}
else
{
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$sOSMType = formatOSMType($aPlace['osm_type']);
@ -62,6 +63,6 @@
$aFilteredPlaces['geokml'] = $aPlace['askml'];
}
}
}
javascript_renderData($aFilteredPlaces);
javascript_renderData($aFilteredPlaces);

View File

@ -1,25 +1,25 @@
<?php
header("content-type: text/xml; charset=UTF-8");
header("content-type: text/xml; charset=UTF-8");
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
echo ">\n";
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
echo ">\n";
echo "<reversegeocode";
echo " timestamp='".date(DATE_RFC822)."'";
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
echo ">\n";
echo "<reversegeocode";
echo " timestamp='".date(DATE_RFC822)."'";
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
echo ">\n";
if (!sizeof($aPlace))
{
if (!sizeof($aPlace))
{
if (isset($sError))
echo "<error>$sError</error>";
else
echo "<error>Unable to geocode</error>";
}
else
{
}
else
{
echo "<result";
if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
$sOSMType = formatOSMType($aPlace['osm_type']);
@ -98,6 +98,6 @@
echo "</geokml>";
}
}
}
echo "</reversegeocode>";
echo "</reversegeocode>";

View File

@ -1,4 +1,4 @@
<header class="container-fluid">
<header class="container-fluid">
<div class="row">
<div class="col-xs-4">
<div class="brand">
@ -29,9 +29,9 @@
</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-content">
<div class="modal-header">
@ -46,4 +46,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -1,11 +1,11 @@
<?php
$aOutput = array();
$aOutput['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$aOutput['batch'] = array();
$aOutput = array();
$aOutput['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$aOutput['batch'] = array();
foreach($aBatchResults as $aSearchResults)
{
foreach($aBatchResults as $aSearchResults)
{
if (!$aSearchResults) $aSearchResults = array();
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
@ -83,6 +83,6 @@
$aFilteredPlaces[] = $aPlace;
}
$aOutput['batch'][] = $aFilteredPlaces;
}
}
javascript_renderData($aOutput, array('geojson'));
javascript_renderData($aOutput, array('geojson'));

View File

@ -1,9 +1,9 @@
<?php
header("content-type: application/json; charset=UTF-8");
header("content-type: application/json; charset=UTF-8");
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
{
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
{
$aPlace = array(
'place_id'=>$aPointDetails['place_id'],
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
@ -74,6 +74,6 @@
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
$aFilteredPlaces[] = $aPlace;
}
}
javascript_renderData($aFilteredPlaces);
javascript_renderData($aFilteredPlaces);

View File

@ -1,7 +1,8 @@
<?php
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
{
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
{
$aPlace = array(
'place_id'=>$aPointDetails['place_id'],
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
@ -73,6 +74,6 @@
if (isset($aPointDetails['sNameDetails'])) $aPlace['namedetails'] = $aPointDetails['sNameDetails'];
$aFilteredPlaces[] = $aPlace;
}
}
javascript_renderData($aFilteredPlaces);
javascript_renderData($aFilteredPlaces);

View File

@ -1,29 +1,29 @@
<?php
header("content-type: text/xml; charset=UTF-8");
header("content-type: text/xml; charset=UTF-8");
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
echo ">\n";
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
echo ">\n";
echo "<";
echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults');
echo " timestamp='".date(DATE_RFC822)."'";
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
echo " polygon='".($bShowPolygons?'true':'false')."'";
if (sizeof($aExcludePlaceIDs))
{
echo "<";
echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults');
echo " timestamp='".date(DATE_RFC822)."'";
echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
echo " polygon='".($bShowPolygons?'true':'false')."'";
if (sizeof($aExcludePlaceIDs))
{
echo " exclude_place_ids='".htmlspecialchars(join(',',$aExcludePlaceIDs))."'";
}
if ($sMoreURL)
{
}
if ($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']."'";
$sOSMType = formatOSMType($aResult['osm_type']);
if ($sOSMType)
@ -156,6 +156,6 @@
{
echo "/>";
}
}
}
echo "</" . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . ">";
echo "</" . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . ">";

View File

@ -1,105 +1,104 @@
<?php
@define('CONST_BasePath', '@CMAKE_SOURCE_DIR@');
@define('CONST_InstallPath', '@CMAKE_BINARY_DIR@');
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 (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true);
@define('CONST_BasePath', '@CMAKE_SOURCE_DIR@');
@define('CONST_InstallPath', '@CMAKE_BINARY_DIR@');
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 (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true);
// General settings
@define('CONST_Debug', false);
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
@define('CONST_Database_Web_User', 'www-data');
@define('CONST_Max_Word_Frequency', '50000');
@define('CONST_Limit_Reindexing', true);
// Set to false to avoid importing extra postcodes for the US.
@define('CONST_Use_Extra_US_Postcodes', true);
// Set to true after importing Tiger house number data for the US.
// Note: The tables must already exist or queries will throw errors.
// After changing this setting run ./utils/setup --create-functions
// again.
@define('CONST_Use_US_Tiger_Data', false);
// Set to true after importing other external house number data.
// Note: the aux tables must already exist or queries will throw errors.
// After changing this setting run ./utils/setup --create-functions
// again.
@define('CONST_Use_Aux_Location_data', false);
// General settings
@define('CONST_Debug', false);
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
@define('CONST_Database_Web_User', 'www-data');
@define('CONST_Max_Word_Frequency', '50000');
@define('CONST_Limit_Reindexing', true);
// Set to false to avoid importing extra postcodes for the US.
@define('CONST_Use_Extra_US_Postcodes', true);
// Set to true after importing Tiger house number data for the US.
// Note: The tables must already exist or queries will throw errors.
// After changing this setting run ./utils/setup --create-functions
// again.
@define('CONST_Use_US_Tiger_Data', false);
// Set to true after importing other external house number data.
// Note: the aux tables must already exist or queries will throw errors.
// After changing this setting run ./utils/setup --create-functions
// again.
@define('CONST_Use_Aux_Location_data', false);
// Proxy settings
@define('CONST_HTTP_Proxy', false);
@define('CONST_HTTP_Proxy_Host', 'proxy.mydomain.com');
@define('CONST_HTTP_Proxy_Port', '3128');
@define('CONST_HTTP_Proxy_Login', '');
@define('CONST_HTTP_Proxy_Password', '');
// Proxy settings
@define('CONST_HTTP_Proxy', false);
@define('CONST_HTTP_Proxy_Host', 'proxy.mydomain.com');
@define('CONST_HTTP_Proxy_Port', '3128');
@define('CONST_HTTP_Proxy_Login', '');
@define('CONST_HTTP_Proxy_Password', '');
// Paths
@define('CONST_Osm2pgsql_Binary', CONST_InstallPath.'/osm2pgsql/osm2pgsql');
@define('CONST_Osmosis_Binary', '/usr/bin/osmosis');
@define('CONST_Tiger_Data_Path', CONST_BasePath.'/data/tiger');
// Paths
@define('CONST_Osm2pgsql_Binary', CONST_InstallPath.'/osm2pgsql/osm2pgsql');
@define('CONST_Osmosis_Binary', '/usr/bin/osmosis');
@define('CONST_Tiger_Data_Path', CONST_BasePath.'/data/tiger');
// osm2pgsql settings
@define('CONST_Osm2pgsql_Flatnode_File', null);
// osm2pgsql settings
@define('CONST_Osm2pgsql_Flatnode_File', null);
// tablespace settings
// osm2pgsql caching tables (aka slim mode tables) - update only
@define('CONST_Tablespace_Osm2pgsql_Data', false);
@define('CONST_Tablespace_Osm2pgsql_Index', false);
// osm2pgsql output tables (aka main table) - update only
@define('CONST_Tablespace_Place_Data', false);
@define('CONST_Tablespace_Place_Index', false);
// address computation tables - update only
@define('CONST_Tablespace_Address_Data', false);
@define('CONST_Tablespace_Address_Index', false);
// search tables - needed for lookups
@define('CONST_Tablespace_Search_Data', false);
@define('CONST_Tablespace_Search_Index', false);
// additional data, e.g. TIGER data, type searches - needed for lookups
@define('CONST_Tablespace_Aux_Data', false);
@define('CONST_Tablespace_Aux_Index', false);
// tablespace settings
// osm2pgsql caching tables (aka slim mode tables) - update only
@define('CONST_Tablespace_Osm2pgsql_Data', false);
@define('CONST_Tablespace_Osm2pgsql_Index', false);
// osm2pgsql output tables (aka main table) - update only
@define('CONST_Tablespace_Place_Data', false);
@define('CONST_Tablespace_Place_Index', false);
// address computation tables - update only
@define('CONST_Tablespace_Address_Data', false);
@define('CONST_Tablespace_Address_Index', false);
// search tables - needed for lookups
@define('CONST_Tablespace_Search_Data', false);
@define('CONST_Tablespace_Search_Index', false);
// additional data, e.g. TIGER data, type searches - needed for lookups
@define('CONST_Tablespace_Aux_Data', false);
@define('CONST_Tablespace_Aux_Index', false);
// Replication settings
@define('CONST_Replication_Url', 'http://planet.openstreetmap.org/replication/minute');
@define('CONST_Replication_MaxInterval', '3600');
@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
// Replication settings
@define('CONST_Replication_Url', 'http://planet.openstreetmap.org/replication/minute');
@define('CONST_Replication_MaxInterval', '3600');
@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
// Website settings
@define('CONST_NoAccessControl', true);
// Website settings
@define('CONST_NoAccessControl', true);
@define('CONST_Website_BaseURL', 'http://'.php_uname('n').'/');
// Language to assume when none is supplied with the query.
// When set to false, the local language (i.e. the name tag without suffix)
// will be used.
@define('CONST_Default_Language', false);
// Appearance of the map in the debug interface.
@define('CONST_Default_Lat', 20.0);
@define('CONST_Default_Lon', 0.0);
@define('CONST_Default_Zoom', 2);
@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_Website_BaseURL', 'http://'.php_uname('n').'/');
// Language to assume when none is supplied with the query.
// When set to false, the local language (i.e. the name tag without suffix)
// will be used.
@define('CONST_Default_Language', false);
// Appearance of the map in the debug interface.
@define('CONST_Default_Lat', 20.0);
@define('CONST_Default_Lon', 0.0);
@define('CONST_Default_Zoom', 2);
@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_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_NameOnlySearchFrequencyThreshold', 500);
// If set to true, then reverse order of queries will be tried by default.
// When set to false only selected languages alloow reverse search.
@define('CONST_Search_ReversePlanForAll', true);
@define('CONST_Search_TryDroppedAddressTerms', false);
@define('CONST_Search_NameOnlySearchFrequencyThreshold', 500);
// If set to true, then reverse order of queries will be tried by default.
// When set to false only selected languages alloow reverse search.
@define('CONST_Search_ReversePlanForAll', true);
// Maximum number of OSM ids that may be queried at once
// for the places endpoint.
@define('CONST_Places_Max_ID_count', 50);
// Maximum number of OSM ids that may be queried at once
// for the places endpoint.
@define('CONST_Places_Max_ID_count', 50);
// Number of different geometry formats that may be queried in parallel.
// Set to zero to disable polygon output.
@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);
// Number of different geometry formats that may be queried in parallel.
// Set to zero to disable polygon output.
@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);

View File

@ -1,4 +1,5 @@
<?php
echo "ERROR: Scripts must be run from build directory.\n";
exit;
echo "ERROR: Scripts must be run from build directory.\n";
exit;

View File

@ -1,11 +1,11 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Manage service blocks / restrictions",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
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('delete', 'd', 0, 1, 0, 0, 'bool', 'Clear recent blocks list'),
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)
{
{
echo "ERROR: Bucket memcache is not configured\n";
exit;
}
}
if ($aResult['list'])
{
if ($aResult['list'])
{
$iCurrentSleeping = $m->get('sleepCounter');
echo "\n Sleeping blocks count: $iCurrentSleeping\n";
@ -39,15 +39,15 @@
date("r", $aDetails['lastBlockTimestamp']), $aDetails['isSleeping']?'Y':'N');
}
echo "\n";
}
}
if ($aResult['delete'])
{
if ($aResult['delete'])
{
$m->set('sleepCounter', 0);
clearBucketBlocks();
}
}
if ($aResult['flush'])
{
if ($aResult['flush'])
{
$m->flush();
}
}

View File

@ -1,8 +1,8 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
ini_set('display_errors', 'stderr');
@ -15,10 +15,10 @@
);
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';
$sWikiPageXML = file_get_contents($sURL);
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";
}
}
}
}

View File

@ -1,11 +1,11 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Create and setup nominatim search system",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
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('parse-articles', '', 0, 1, 0, 0, 'bool', 'Parse wikipedia articles'),
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
@ -58,8 +58,8 @@ exit;
}
*/
if ($aCMDResult['create-tables'])
{
if ($aCMDResult['create-tables'])
{
$sSQL = <<<'EOD'
CREATE TABLE wikipedia_article (
language text NOT NULL,
@ -88,16 +88,16 @@ CREATE TABLE wikipedia_link (
);
EOD;
$oDB->query($sSQL);
}
}
function degreesAndMinutesToDecimal($iDegrees, $iMinutes=0, $fSeconds=0, $sNSEW='N')
{
function degreesAndMinutesToDecimal($iDegrees, $iMinutes=0, $fSeconds=0, $sNSEW='N')
{
$sNSEW = strtoupper($sNSEW);
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 = preg_replace('#<!--.*?-->#m', '', $sPageText);
$sPageText = preg_replace('#<math>.*?<\\/math>#m', '', $sPageText);
@ -201,10 +201,10 @@ EOD;
}
}
return $aTemplates;
}
}
function _templatesToProperties($aTemplates)
{
function _templatesToProperties($aTemplates)
{
$aPageProperties = array();
foreach($aTemplates as $iTemplate => $aTemplate)
{
@ -345,10 +345,10 @@ EOD;
unset($aPageProperties['sPossibleInfoboxType']);
}
return $aPageProperties;
}
}
if (isset($aCMDResult['parse-wikipedia']))
{
if (isset($aCMDResult['parse-wikipedia']))
{
$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($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);
}
}
}
}
function nominatimXMLStart($hParser, $sName, $aAttr)
{
function nominatimXMLStart($hParser, $sName, $aAttr)
{
global $aNominatRecords;
switch($sName)
{
@ -401,15 +401,15 @@ EOD;
$aNominatRecords[] = $aAttr;
break;
}
}
}
function nominatimXMLEnd($hParser, $sName)
{
}
function nominatimXMLEnd($hParser, $sName)
{
}
if (isset($aCMDResult['link']))
{
if (isset($aCMDResult['link']))
{
$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");
@ -591,4 +591,4 @@ EOD;
}
}
}
}
}

View File

@ -1,23 +1,23 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Create and setup nominatim search system",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet 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)'),
);
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);
$sTempDir = tempnam('/tmp', 'tiger');
@ -58,4 +58,4 @@
}
}
}
}

View File

@ -1,13 +1,13 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
require_once(CONST_BasePath.'/lib/Geocode.php');
require_once(CONST_BasePath.'/lib/ParameterParser.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
require_once(CONST_BasePath.'/lib/Geocode.php');
require_once(CONST_BasePath.'/lib/ParameterParser.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Query database from command line. Returns search result as JSON.",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
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('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')
);
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
);
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true);
$oDB =& getDB();
$oParams = new ParameterParser($aCMDResult);
$oDB =& getDB();
$oParams = new ParameterParser($aCMDResult);
if ($oParams->getBool('search'))
{
if ($oParams->getBool('search'))
{
if (isset($aCMDResult['nodedupe'])) $aCMDResult['dedupe'] = 'false';
$oGeocode = new Geocode($oDB);
@ -45,11 +45,8 @@
echo json_encode($aSearchResults);
else
echo json_encode($aSearchResults, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n";
}
else
{
}
else
{
showUsage($aCMDOptions, true);
}
}

View File

@ -1,27 +1,27 @@
#!/usr/bin/php -Cq
<?php
// Apache log file
$sFile = "sample.log.txt";
$sHost1 = 'http://mq-open-search-lm02.ihost.aol.com:8000/nominatim/v1';
$sHost2 = 'http://mq-open-search-lm03.ihost.aol.com:8000/nominatim/v1';
// Apache log file
$sFile = "sample.log.txt";
$sHost1 = 'http://mq-open-search-lm02.ihost.aol.com:8000/nominatim/v1';
$sHost2 = 'http://mq-open-search-lm03.ihost.aol.com:8000/nominatim/v1';
$sHost1Escaped = str_replace('/', '\\/', $sHost1);
$sHost2Escaped = str_replace('/', '\\/', $sHost2);
$sHost1Escaped = str_replace('/', '\\/', $sHost1);
$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");
if (!$hFile)
{
$hFile = @fopen($sFile, "r");
if (!$hFile)
{
echo "Unable to open file: $sFile\n";
exit;
}
}
$i = 0;
while (($sLine = fgets($hFile, 10000)) !== false)
{
$i = 0;
while (($sLine = fgets($hFile, 10000)) !== false)
{
$i++;
if (!in_array($i, $aToDo)) continue;
@ -73,6 +73,6 @@
{
var_dump($sLine);
}
}
}
fclose($hFile);
fclose($hFile);

View File

@ -1,11 +1,11 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Create and setup nominatim search system",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
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('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)'),
);
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
if ($aCMDResult['import-data'] || $aCMDResult['all'])
{
// 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 (!isset($aCMDResult['osm-file']))
{
fail('missing --osm-file for data import');
@ -60,37 +60,37 @@
{
fail('osm-file "'.$aCMDResult['osm-file'].'" not readable');
}
}
}
// This is a pretty hard core default - the number of processors in the box - 1
$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
if ($iInstances < 1)
{
// This is a pretty hard core default - the number of processors in the box - 1
$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
if ($iInstances < 1)
{
$iInstances = 1;
echo "WARNING: resetting threads to $iInstances\n";
}
if ($iInstances > getProcessorCount())
{
}
if ($iInstances > getProcessorCount())
{
$iInstances = getProcessorCount();
echo "WARNING: resetting threads to $iInstances\n";
}
}
// Assume we can steal all the cache memory in the box (unless told otherwise)
if (isset($aCMDResult['osm2pgsql-cache']))
{
// Assume we can steal all the cache memory in the box (unless told otherwise)
if (isset($aCMDResult['osm2pgsql-cache']))
{
$iCacheMemory = $aCMDResult['osm2pgsql-cache'];
}
else
{
}
else
{
$iCacheMemory = getCacheMemoryMB();
}
}
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
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";
$bDidSomething = true;
$oDB = DB::connect(CONST_Database_DSN, false);
@ -99,10 +99,10 @@
fail('database already exists ('.CONST_Database_DSN.')');
}
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";
$bDidSomething = true;
// TODO: path detection, detection memory, etc.
@ -168,10 +168,10 @@
// versions in create-tables.
pgsqlRunScript('CREATE TABLE place_boundingbox ()');
pgsqlRunScript('create type wikipedia_article_match as ()');
}
}
if ($aCMDResult['import-data'] || $aCMDResult['all'])
{
if ($aCMDResult['import-data'] || $aCMDResult['all'])
{
echo "Import\n";
$bDidSomething = true;
@ -205,18 +205,18 @@
{
fail('No Data');
}
}
}
if ($aCMDResult['create-functions'] || $aCMDResult['all'])
{
if ($aCMDResult['create-functions'] || $aCMDResult['all'])
{
echo "Functions\n";
$bDidSomething = true;
if (!file_exists(CONST_InstallPath.'/module/nominatim.so')) fail("nominatim module not built");
create_sql_functions($aCMDResult);
}
}
if ($aCMDResult['create-tables'] || $aCMDResult['all'])
{
if ($aCMDResult['create-tables'] || $aCMDResult['all'])
{
$bDidSomething = true;
echo "Tables\n";
@ -239,10 +239,10 @@
// re-run the functions
echo "Functions\n";
create_sql_functions($aCMDResult);
}
}
if ($aCMDResult['create-partition-tables'] || $aCMDResult['all'])
{
if ($aCMDResult['create-partition-tables'] || $aCMDResult['all'])
{
echo "Partition Tables\n";
$bDidSomething = true;
@ -261,21 +261,21 @@
CONST_Tablespace_Aux_Index, $sTemplate);
pgsqlRunPartitionScript($sTemplate);
}
}
if ($aCMDResult['create-partition-functions'] || $aCMDResult['all'])
{
if ($aCMDResult['create-partition-functions'] || $aCMDResult['all'])
{
echo "Partition Functions\n";
$bDidSomething = true;
$sTemplate = file_get_contents(CONST_BasePath.'/sql/partition-functions.src.sql');
pgsqlRunPartitionScript($sTemplate);
}
}
if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all'])
{
if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all'])
{
$bDidSomething = true;
$sWikiArticlesFile = CONST_BasePath.'/data/wikipedia_article.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";
}
}
}
if ($aCMDResult['load-data'] || $aCMDResult['all'])
{
if ($aCMDResult['load-data'] || $aCMDResult['all'])
{
echo "Drop old Data\n";
$bDidSomething = true;
@ -384,10 +384,10 @@
echo "\n";
echo "Reanalysing database...\n";
pgsqlRunScript('ANALYSE');
}
}
if ($aCMDResult['import-tiger-data'])
{
if ($aCMDResult['import-tiger-data'])
{
$bDidSomething = true;
$sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql');
@ -455,10 +455,10 @@
$sTemplate = replace_tablespace('{ts:aux-index}',
CONST_Tablespace_Aux_Index, $sTemplate);
pgsqlRunScript($sTemplate, false);
}
}
if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all'])
{
if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all'])
{
$bDidSomething = true;
$oDB =& getDB();
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";
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;
$oDB =& getDB();
@ -570,10 +570,10 @@
}
}
}
}
}
if ($aCMDResult['index'] || $aCMDResult['all'])
{
if ($aCMDResult['index'] || $aCMDResult['all'])
{
$bDidSomething = true;
$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');
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
passthruCheckReturn($sBaseCmd.' -r 26');
}
}
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
{
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
{
echo "Search indices\n";
$bDidSomething = true;
@ -598,10 +598,10 @@
CONST_Tablespace_Aux_Index, $sTemplate);
pgsqlRunScript($sTemplate);
}
}
if ($aCMDResult['drop'])
{
if ($aCMDResult['drop'])
{
// The implementation is potentially a bit dangerous because it uses
// a positive selection of tables to keep, and deletes everything else.
// Including any tables that the unsuspecting user might have manually
@ -658,19 +658,19 @@
if ($aCMDResult['verbose']) echo "deleting ".CONST_Osm2pgsql_Flatnode_File."\n";
unlink(CONST_Osm2pgsql_Flatnode_File);
}
}
}
if (!$bDidSomething)
{
if (!$bDidSomething)
{
showUsage($aCMDOptions, true);
}
else
{
}
else
{
echo "Setup finished.\n";
}
}
function pgsqlRunScriptFile($sFilename)
{
function pgsqlRunScriptFile($sFilename)
{
if (!file_exists($sFilename)) fail('unable to find '.$sFilename);
// Convert database DSN to psql parameters
@ -725,10 +725,10 @@
proc_close($hGzipProcess);
}
}
}
function pgsqlRunScript($sScript, $bfatal = true)
{
function pgsqlRunScript($sScript, $bfatal = true)
{
global $aCMDResult;
// Convert database DSN to psql parameters
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
@ -757,10 +757,10 @@
{
fail("pgsql returned with error code ($iReturn)");
}
}
}
function pgsqlRunPartitionScript($sTemplate)
{
function pgsqlRunPartitionScript($sTemplate)
{
global $aCMDResult;
$oDB =& getDB();
@ -780,10 +780,10 @@
}
pgsqlRunScript($sTemplate);
}
}
function pgsqlRunRestoreData($sDumpFile)
{
function pgsqlRunRestoreData($sDumpFile)
{
// Convert database DSN to psql parameters
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
@ -808,10 +808,10 @@
fclose($ahPipes[1]);
$iReturn = proc_close($hProcess);
}
}
function pgsqlRunDropAndRestore($sDumpFile)
{
function pgsqlRunDropAndRestore($sDumpFile)
{
// Convert database DSN to psql parameters
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
@ -836,17 +836,17 @@
fclose($ahPipes[1]);
$iReturn = proc_close($hProcess);
}
}
function passthruCheckReturn($cmd)
{
function passthruCheckReturn($cmd)
{
$result = -1;
passthru($cmd, $result);
if ($result != 0) fail('Error executing external command: '.$cmd);
}
}
function replace_tablespace($sTemplate, $sTablespace, $sSql)
{
function replace_tablespace($sTemplate, $sTablespace, $sSql)
{
if ($sTablespace)
$sSql = str_replace($sTemplate, 'TABLESPACE "'.$sTablespace.'"',
$sSql);
@ -854,10 +854,10 @@
$sSql = str_replace($sTemplate, '', $sSql);
return $sSql;
}
}
function create_sql_functions($aCMDResult)
{
function create_sql_functions($aCMDResult)
{
$sTemplate = file_get_contents(CONST_BasePath.'/sql/functions.sql');
$sTemplate = str_replace('{modulepath}', CONST_InstallPath.'/module', $sTemplate);
if ($aCMDResult['enable-diff-updates'])
@ -882,5 +882,5 @@
}
pgsqlRunScript($sTemplate);
}
}

View File

@ -1,10 +1,10 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
ini_set('display_errors', 'stderr');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
ini_set('display_errors', 'stderr');
$aCMDOptions = array(
"Import and export special phrases",
@ -19,7 +19,7 @@
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('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";
@ -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";
}
}
}
if ($aCMDResult['wiki-import'])
{
if ($aCMDResult['wiki-import'])
{
$aPairs = array();
foreach($aLanguageIn as $sLanguage)
@ -111,4 +111,4 @@
}
echo "drop index idx_placex_classtype;";
}
}

View File

@ -1,11 +1,11 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Import / update / index osm data",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
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('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-rank'])) $aResult['index-rank'] = 0;
if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
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);
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
// cache memory to be used by osm2pgsql, should not be more than the available memory
$iCacheMemory = (isset($aResult['osm2pgsql-cache'])?$aResult['osm2pgsql-cache']:2000);
if ($iCacheMemory + 500 > getTotalMemoryMB())
{
// cache memory to be used by osm2pgsql, should not be more than the available memory
$iCacheMemory = (isset($aResult['osm2pgsql-cache'])?$aResult['osm2pgsql-cache']:2000);
if ($iCacheMemory + 500 > getTotalMemoryMB())
{
$iCacheMemory = getCacheMemoryMB();
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'];
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
{
}
$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))
{
$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)
$sNextFile = $aResult['import-diff'];
if (!file_exists($sNextFile))
@ -79,12 +79,12 @@
}
// Don't update the import status - we don't know what this file contains
}
}
$sTemporaryFile = CONST_BasePath.'/data/osmosischange.osc';
$bHaveDiff = false;
if (isset($aResult['import-file']) && $aResult['import-file'])
{
$sTemporaryFile = CONST_BasePath.'/data/osmosischange.osc';
$bHaveDiff = false;
if (isset($aResult['import-file']) && $aResult['import-file'])
{
$bHaveDiff = true;
$sCMD = CONST_Osmosis_Binary.' --read-xml \''.$aResult['import-file'].'\' --read-empty --derive-change --write-xml-change '.$sTemporaryFile;
echo $sCMD."\n";
@ -93,12 +93,12 @@
{
fail("Error converting osm to osc, osmosis returned: $iErrorLevel\n");
}
}
}
$bUseOSMApi = isset($aResult['import-from-main-api']) && $aResult['import-from-main-api'];
$sContentURL = '';
if (isset($aResult['import-node']) && $aResult['import-node'])
{
$bUseOSMApi = isset($aResult['import-from-main-api']) && $aResult['import-from-main-api'];
$sContentURL = '';
if (isset($aResult['import-node']) && $aResult['import-node'])
{
if ($bUseOSMApi)
{
$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;';
}
}
if (isset($aResult['import-way']) && $aResult['import-way'])
{
}
if (isset($aResult['import-way']) && $aResult['import-way'])
{
if ($bUseOSMApi)
{
$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;';
}
}
if (isset($aResult['import-relation']) && $aResult['import-relation'])
{
}
if (isset($aResult['import-relation']) && $aResult['import-relation'])
{
if ($bUseOSMApi)
{
$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;';
}
}
if ($sContentURL)
{
}
if ($sContentURL)
{
$sModifyXMLstr = file_get_contents($sContentURL);
$bHaveDiff = true;
@ -161,10 +161,10 @@
echo $sErrors;
fail("Error converting osm to osc, osmosis returned: $iError\n");
}
}
}
if ($bHaveDiff)
{
if ($bHaveDiff)
{
// import generated change file
$sCMD = $sOsm2pgsqlCmd.' '.$sTemporaryFile;
echo $sCMD."\n";
@ -173,10 +173,10 @@
{
fail("osm2pgsql exited with error level $iErrorLevel\n");
}
}
}
if ($aResult['deduplicate'])
{
if ($aResult['deduplicate'])
{
if (getPostgresVersion() < 9.3)
{
@ -235,15 +235,15 @@
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']);
}
}
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) {
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";
sleep($iSleep);
}
}
}
function getosmosistimestamp($sOsmosisConfigDirectory)
{
function getosmosistimestamp($sOsmosisConfigDirectory)
{
$sStateFile = file_get_contents($sOsmosisConfigDirectory.'/state.txt');
preg_match('#timestamp=(.+)#', $sStateFile, $aResult);
return str_replace('\:',':',$aResult[1]);
}
}

View File

@ -1,30 +1,30 @@
#!/usr/bin/php -Cq
<?php
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-cmd.php');
ini_set('memory_limit', '800M');
$aCMDOptions = array(
$aCMDOptions = array(
"Tools to warm nominatim db",
array('help', 'h', 0, 1, 0, 0, false, 'Show Help'),
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
array('reverse-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/Geocode.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/Geocode.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.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->setZoom(20);
@ -48,9 +48,9 @@
else echo ".";
}
echo "\n";
}
}
if (!$aResult['reverse-only']) {
if (!$aResult['reverse-only']) {
$oGeocode =& new Geocode($oDB);
@ -65,5 +65,5 @@
if ($bVerbose) echo $aSearchResults[0]['langaddress']."\n";
else echo ".";
}
}
}

View File

@ -1,26 +1,26 @@
<?php
@define('CONST_ConnectionBucket_PageType', 'Details');
@define('CONST_ConnectionBucket_PageType', 'Details');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oParams = new ParameterParser();
$oParams = new ParameterParser();
$sOutputFormat = 'html';
$aLangPrefOrder = $oParams->getPreferredLanguages();
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
$sOutputFormat = 'html';
$aLangPrefOrder = $oParams->getPreferredLanguages();
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
$sPlaceId = $oParams->getString('place_id');
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
$iOsmId = $oParams->getInt('osmid', -1);
$sPlaceId = $oParams->getString('place_id');
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
$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"));
// Be nice about our error messages for broken geometry
@ -43,91 +43,91 @@
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));
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));
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
$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 .= " ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ";
//$sSQL .= " ST_Area(geometry::geography) as area, ";
$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 .= " 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";
$aPointDetails = chksql($oDB->getRow($sSQL),
// 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 .= " 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_Area(geometry::geography) as area, ";
$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 .= " 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";
$aPointDetails = chksql($oDB->getRow($sSQL),
"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();
$aPointDetails['icon'] = $aClassType[$aPointDetails['class'].':'.$aPointDetails['type']]['icon'];
$aClassType = getClassTypesWithImportance();
$aPointDetails['icon'] = $aClassType[$aPointDetails['class'].':'.$aPointDetails['type']]['icon'];
// 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";
$aPointDetails['aNames'] = $oDB->getAssoc($sSQL);
if (PEAR::isError($aPointDetails['aNames'])) // possible timeout
{
// 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";
$aPointDetails['aNames'] = $oDB->getAssoc($sSQL);
if (PEAR::isError($aPointDetails['aNames'])) // possible timeout
{
$aPointDetails['aNames'] = [];
}
}
// Extra tags
$sSQL = "select (each(extratags)).key,(each(extratags)).value from placex where place_id = $iPlaceID order by (each(extratags)).key";
$aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);
if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout
{
// Extra tags
$sSQL = "select (each(extratags)).key,(each(extratags)).value from placex where place_id = $iPlaceID order by (each(extratags)).key";
$aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);
if (PEAR::isError($aPointDetails['aExtraTags'])) // possible timeout
{
$aPointDetails['aExtraTags'] = [];
}
}
// Address
$aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], -1, true);
// Address
$aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], -1, true);
// 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 .= " 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 .= " where linked_place_id = $iPlaceID";
$sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
$aLinkedLines = $oDB->getAll($sSQL);
if (PEAR::isError($aLinkedLines)) // possible timeout
{
// 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 .= " 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 .= " where linked_place_id = $iPlaceID";
$sSQL .= " order by rank_address asc,rank_search asc,get_name_by_language(name,$sLanguagePrefArraySQL),housenumber";
$aLinkedLines = $oDB->getAll($sSQL);
if (PEAR::isError($aLinkedLines)) // possible timeout
{
$aLinkedLines = [];
}
}
// 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 .= " 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 .= " 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 .= " order by rank_address asc,rank_search asc,localname,housenumber";
$aParentOfLines = $oDB->getAll($sSQL);
if (PEAR::isError($aParentOfLines)) // possible timeout
{
// 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 .= " 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 .= " 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 .= " order by rank_address asc,rank_search asc,localname,housenumber";
$aParentOfLines = $oDB->getAll($sSQL);
if (PEAR::isError($aParentOfLines)) // possible timeout
{
$aParentOfLines = [];
}
}
$aPlaceSearchNameKeywords = false;
$aPlaceSearchAddressKeywords = false;
if ($oParams->getBool('keywords'))
{
$aPlaceSearchNameKeywords = false;
$aPlaceSearchAddressKeywords = false;
if ($oParams->getBool('keywords'))
{
$sSQL = "select * from search_name where place_id = $iPlaceID";
$aPlaceSearchName = $oDB->getRow($sSQL);
if (PEAR::isError($aPlaceSearchName)) // possible timeout
@ -150,15 +150,15 @@
$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"));
$sTileURL = CONST_Map_Tile_URL;
$sTileAttribution = CONST_Map_Tile_Attribution;
}
}
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');

View File

@ -1,27 +1,27 @@
<?php
@define('CONST_ConnectionBucket_PageType', 'Details');
@define('CONST_ConnectionBucket_PageType', 'Details');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oParams = new ParameterParser();
$oParams = new ParameterParser();
$sOutputFormat = $oParams->getSet('format', array('html', 'json'), 'html');
$aLangPrefOrder = $oParams->getPreferredLanguages();
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
$sOutputFormat = $oParams->getSet('format', array('html', 'json'), 'html');
$aLangPrefOrder = $oParams->getPreferredLanguages();
$sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]";
$sPlaceId = $oParams->getString('place_id');
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
$iOsmId = $oParams->getInt('osmid', -1);
$sPlaceId = $oParams->getString('place_id');
$sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R'));
$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"));
// Be nice about our error messages for broken geometry
@ -38,35 +38,35 @@
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));
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));
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
}
}
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails(true);
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$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();
foreach($aPlaceAddress as $i => $aPlace)
{
$aBreadcrums = array();
foreach($aPlaceAddress as $i => $aPlace)
{
if (!$aPlace['place_id']) continue;
$aBreadcrums[] = array('placeId' => $aPlace['place_id'],
'osmType' => $aPlace['osm_type'],
@ -79,29 +79,29 @@
if ($i) echo " &gt; ";
echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> ('.osmLink($aPlace).')';
}
}
}
if ($sOutputFormat == 'json')
{
if ($sOutputFormat == 'json')
{
header("content-type: application/json; charset=UTF-8");
$aDetails = array();
$aDetails['breadcrumbs'] = $aBreadcrums;
javascript_renderData($aDetails);
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 .= " 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 .= " 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";
$aParentOfLines = chksql($oDB->getAll($sSQL));
$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 .= " 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 .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber";
$aParentOfLines = chksql($oDB->getAll($sSQL));
if (sizeof($aParentOfLines))
{
if (sizeof($aParentOfLines))
{
echo '<h2>Parent Of:</h2>';
$aClassType = getClassTypesWithImportance();
$aGroupedAddressLines = array();
@ -146,4 +146,4 @@
echo '<p>There are more child objects which are not shown.</p>';
}
echo '</div>';
}
}

View File

@ -1,43 +1,43 @@
<?php
@define('CONST_ConnectionBucket_PageType', 'Reverse');
@define('CONST_ConnectionBucket_PageType', 'Reverse');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oParams = new ParameterParser();
$oParams = new ParameterParser();
// Format for output
$sOutputFormat = $oParams->getSet('format', array('xml', 'json'), 'xml');
// Format for output
$sOutputFormat = $oParams->getSet('format', array('xml', 'json'), 'xml');
// Preferred language
$aLangPrefOrder = $oParams->getPreferredLanguages();
// Preferred language
$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();
$aCleanedQueryParts = array();
$aSearchResults = array();
$aCleanedQueryParts = array();
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', 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.");
}
}
foreach ($aOsmIds AS $sItem)
{
foreach ($aOsmIds AS $sItem)
{
// Skip empty sItem
if (empty($sItem)) continue;
@ -59,17 +59,17 @@
$aSearchResults[] = $oResult;
}
}
}
}
if (CONST_Debug) exit;
if (CONST_Debug) exit;
$sXmlRootTag = 'lookupresults';
$sQuery = join(',',$aCleanedQueryParts);
// we initialize these to avoid warnings in our logfile
$sViewBox = '';
$bShowPolygons = '';
$aExcludePlaceIDs = [];
$sMoreURL = '';
$sXmlRootTag = 'lookupresults';
$sQuery = join(',',$aCleanedQueryParts);
// we initialize these to avoid warnings in our logfile
$sViewBox = '';
$bShowPolygons = '';
$aExcludePlaceIDs = [];
$sMoreURL = '';
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');

View File

@ -1,23 +1,23 @@
<?php
@define('CONST_ConnectionBucket_PageType', 'Reverse');
@define('CONST_ConnectionBucket_PageType', 'Reverse');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oParams = new ParameterParser();
$oParams = new ParameterParser();
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
$bAsKML = $oParams->getBool('polygon_kml');
$bAsSVG = $oParams->getBool('polygon_svg');
$bAsText = $oParams->getBool('polygon_text');
if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
$bAsKML = $oParams->getBool('polygon_kml');
$bAsSVG = $oParams->getBool('polygon_svg');
$bAsText = $oParams->getBool('polygon_text');
if ((($bAsGeoJSON?1:0) + ($bAsKML?1:0) + ($bAsSVG?1:0)
+ ($bAsText?1:0)) > CONST_PolygonOutput_MaximumTypes)
{
{
if (CONST_PolygonOutput_MaximumTypes)
{
userError("Select only ".CONST_PolygonOutput_MaximumTypes." polgyon output option");
@ -26,38 +26,38 @@
{
userError("Polygon output is disabled");
}
}
}
// Polygon simplification threshold (optional)
$fThreshold = $oParams->getFloat('polygon_threshold', 0.0);
// Polygon simplification threshold (optional)
$fThreshold = $oParams->getFloat('polygon_threshold', 0.0);
// Format for output
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'xml');
// Format for output
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'xml');
// Preferred language
$aLangPrefOrder = $oParams->getPreferredLanguages();
// Preferred language
$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->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
$oPlaceLookup = new PlaceLookup($oDB);
$oPlaceLookup->setLanguagePreference($aLangPrefOrder);
$oPlaceLookup->setIncludeAddressDetails($oParams->getBool('addressdetails', true));
$oPlaceLookup->setIncludeExtraTags($oParams->getBool('extratags', false));
$oPlaceLookup->setIncludeNameDetails($oParams->getBool('namedetails', false));
$sOsmType = $oParams->getSet('osm_type', array('N', 'W', 'R'));
$iOsmId = $oParams->getInt('osm_id', -1);
$fLat = $oParams->getFloat('lat');
$fLon = $oParams->getFloat('lon');
if ($sOsmType && $iOsmId > 0)
{
$sOsmType = $oParams->getSet('osm_type', array('N', 'W', 'R'));
$iOsmId = $oParams->getInt('osm_id', -1);
$fLat = $oParams->getFloat('lat');
$fLon = $oParams->getFloat('lon');
if ($sOsmType && $iOsmId > 0)
{
$aPlace = $oPlaceLookup->lookupOSMID($sOsmType, $iOsmId);
}
else if ($fLat !== false && $fLon !== false)
{
}
else if ($fLat !== false && $fLon !== false)
{
$oReverseGeocode = new ReverseGeocode($oDB);
$oReverseGeocode->setZoom($oParams->getInt('zoom', 18));
@ -66,14 +66,14 @@
$aPlace = $oPlaceLookup->lookup((int)$aLookup['place_id'],
$aLookup['type'], $aLookup['fraction']);
}
else if ($sOutputFormat != 'html')
{
}
else if ($sOutputFormat != 'html')
{
userError("Need coordinates or OSM object to lookup.");
}
}
if ($aPlace)
{
if ($aPlace)
{
$oPlaceLookup->setIncludePolygonAsPoints(false);
$oPlaceLookup->setIncludePolygonAsText($bAsText);
$oPlaceLookup->setIncludePolygonAsGeoJSON($bAsGeoJSON);
@ -90,19 +90,19 @@
{
$aPlace = array_merge($aPlace, $aOutlineResult);
}
}
}
if (CONST_Debug)
{
if (CONST_Debug)
{
var_dump($aPlace);
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"));
$sTileURL = CONST_Map_Tile_URL;
$sTileAttribution = CONST_Map_Tile_Attribution;
}
include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php');
}
include(CONST_BasePath.'/lib/template/address-'.$sOutputFormat.'.php');

View File

@ -1,41 +1,41 @@
<?php
@define('CONST_ConnectionBucket_PageType', 'Search');
@define('CONST_ConnectionBucket_PageType', 'Search');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/Geocode.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(CONST_BasePath.'/lib/log.php');
require_once(CONST_BasePath.'/lib/Geocode.php');
require_once(CONST_BasePath.'/lib/output.php');
ini_set('memory_limit', '200M');
$oDB =& getDB();
$oParams = new ParameterParser();
$oDB =& getDB();
$oParams = new ParameterParser();
$oGeocode = new Geocode($oDB);
$oGeocode = new Geocode($oDB);
$aLangPrefOrder = $oParams->getPreferredLanguages();
$oGeocode->setLanguagePreference($aLangPrefOrder);
$aLangPrefOrder = $oParams->getPreferredLanguages();
$oGeocode->setLanguagePreference($aLangPrefOrder);
if (CONST_Search_ReversePlanForAll
if (CONST_Search_ReversePlanForAll
|| isset($aLangPrefOrder['name:de'])
|| isset($aLangPrefOrder['name:ru'])
|| isset($aLangPrefOrder['name:ja'])
|| isset($aLangPrefOrder['name:pl']))
{
{
$oGeocode->setReverseInPlan(true);
}
}
// Format for output
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
// Format for output
$sOutputFormat = $oParams->getSet('format', array('html', 'xml', 'json', 'jsonv2'), 'html');
// Show / use polygons
if ($sOutputFormat == 'html')
{
// Show / use polygons
if ($sOutputFormat == 'html')
{
$oGeocode->setIncludePolygonAsText($oParams->getBool('polygon'));
$bAsText = false;
}
else
{
}
else
{
$bAsPoints = $oParams->getBool('polygon');
$bAsGeoJSON = $oParams->getBool('polygon_geojson');
$bAsKML = $oParams->getBool('polygon_kml');
@ -63,15 +63,15 @@
$oGeocode->setIncludePolygonAsGeoJSON($bAsGeoJSON);
$oGeocode->setIncludePolygonAsKML($bAsKML);
$oGeocode->setIncludePolygonAsSVG($bAsSVG);
}
}
// Polygon simplification threshold (optional)
$oGeocode->setPolygonSimplificationThreshold($oParams->getFloat('polygon_threshold', 0.0));
// Polygon simplification threshold (optional)
$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);
$aBatchResults = array();
foreach($aBatch as $aBatchParams)
@ -85,13 +85,13 @@
}
include(CONST_BasePath.'/lib/template/search-batch-json.php');
exit;
}
}
$oGeocode->setQueryFromParams($oParams);
$oGeocode->setQueryFromParams($oParams);
if (!$oGeocode->getQueryString()
if (!$oGeocode->getQueryString()
&& isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
{
{
$sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
// reverse order of '/' separated string
@ -99,34 +99,34 @@
$aPhrases = array_reverse($aPhrases);
$sQuery = join(', ',$aPhrases);
$oGeocode->setQuery($sQuery);
}
}
$hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
$hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
$aSearchResults = $oGeocode->lookup();
if ($aSearchResults === false) $aSearchResults = array();
$aSearchResults = $oGeocode->lookup();
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"));
}
logEnd($oDB, $hLog, sizeof($aSearchResults));
}
logEnd($oDB, $hLog, sizeof($aSearchResults));
$sQuery = $oGeocode->getQueryString();
$sViewBox = $oGeocode->getViewBoxString();
$bShowPolygons = (isset($_GET['polygon']) && $_GET['polygon']);
$aExcludePlaceIDs = $oGeocode->getExcludedPlaceIDs();
$sQuery = $oGeocode->getQueryString();
$sViewBox = $oGeocode->getViewBoxString();
$bShowPolygons = (isset($_GET['polygon']) && $_GET['polygon']);
$aExcludePlaceIDs = $oGeocode->getExcludedPlaceIDs();
$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 ($bShowPolygons) $sMoreURL .= '&polygon=1';
if ($oGeocode->getIncludeAddressDetails()) $sMoreURL .= '&addressdetails=1';
if ($oGeocode->getIncludeExtraTags()) $sMoreURL .= '&extratags=1';
if ($oGeocode->getIncludeNameDetails()) $sMoreURL .= '&namedetails=1';
if ($sViewBox) $sMoreURL .= '&viewbox='.urlencode($sViewBox);
if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon'];
$sMoreURL .= '&q='.urlencode($sQuery);
$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 ($bShowPolygons) $sMoreURL .= '&polygon=1';
if ($oGeocode->getIncludeAddressDetails()) $sMoreURL .= '&addressdetails=1';
if ($oGeocode->getIncludeExtraTags()) $sMoreURL .= '&extratags=1';
if ($oGeocode->getIncludeNameDetails()) $sMoreURL .= '&namedetails=1';
if ($sViewBox) $sMoreURL .= '&viewbox='.urlencode($sViewBox);
if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon'];
$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');

View File

@ -1,42 +1,42 @@
<?php
@define('CONST_ConnectionBucket_PageType', 'Status');
@define('CONST_ConnectionBucket_PageType', 'Status');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
require_once(CONST_BasePath.'/lib/init-website.php');
function statusError($sMsg)
{
function statusError($sMsg)
{
header("HTTP/1.0 500 Internal Server Error");
echo "ERROR: ".$sMsg;
exit;
}
}
$oDB =& DB::connect(CONST_Database_DSN, false);
if (!$oDB || PEAR::isError($oDB))
{
$oDB =& DB::connect(CONST_Database_DSN, false);
if (!$oDB || PEAR::isError($oDB))
{
statusError("No database");
}
}
$sStandardWord = $oDB->getOne("select make_standard_name('a')");
if (PEAR::isError($sStandardWord))
{
$sStandardWord = $oDB->getOne("select make_standard_name('a')");
if (PEAR::isError($sStandardWord))
{
statusError("Module failed");
}
if ($sStandardWord != 'a')
{
}
if ($sStandardWord != 'a')
{
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')");
if (PEAR::isError($iWordID))
{
$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))
{
statusError("Query failed");
}
if (!$iWordID)
{
}
if (!$iWordID)
{
statusError("No value");
}
}
echo "OK";
exit;
echo "OK";
exit;

View File

@ -1,7 +1,7 @@
<?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);
$sMonth = date("Y-m", $iTimestamp);
$sDay = date("Ymd", $iTimestamp);
@ -85,7 +85,7 @@
@unlink("totals.txt");
rename("newtotals.txt", "totals.txt");
}
}
}
// Notes:
/*