exit;
}
+ function getParamBool($name, $default=false)
+ {
+ if (!isset($_GET[$name])) return $default;
+
+ return (bool) $_GET[$name];
+ }
function fail($sError, $sUserError = false)
{
function bySearchRank($a, $b)
{
if ($a['iSearchRank'] == $b['iSearchRank'])
- return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
+ return strlen($a['sOperator']) + strlen($a['sHouseNumber']) - strlen($b['sOperator']) - strlen($b['sHouseNumber']);
return ($a['iSearchRank'] < $b['iSearchRank']?-1:1);
}
'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:information' => array('label'=>'Information','frequency'=>224,'icon'=>'amenity_information',),
'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',),
'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,),
}
- function javascript_renderData($xVal)
+ function javascript_renderData($xVal, $iOptions = 0)
{
header("Access-Control-Allow-Origin: *");
- $iOptions = 0;
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID > 50400)
- $iOptions = JSON_UNESCAPED_UNICODE;
+ $iOptions |= JSON_UNESCAPED_UNICODE;
$jsonout = json_encode($xVal, $iOptions);
if( ! isset($_GET['json_callback']))
}
// degrees decimal seconds
// N 40 26 46 W 79 58 56
- // N 40° 26′ 46″ W, 79° 58′ 56″
+ // N 40° 26′ 46″, W 79° 58′ 56″
// 1 2 3 4 5 6 7 8
elseif (preg_match('/\\b([NS])[ ]([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+)[″"]*[, ]+([EW])[ ]([0-9]+)[° ]+([0-9]+)[′\' ]+([0-9]+)[″"]*\\b/', $sQuery, $aData))
{
return array('lat' => $fQueryLat, 'lon' => $fQueryLon, 'query' => $sQuery);
}
+
+
+
+ function geometryText2Points($geometry_as_text,$fRadius)
+ {
+ $aPolyPoints = NULL;
+ if (preg_match('#POLYGON\\(\\(([- 0-9.,]+)#',$geometry_as_text,$aMatch))
+ {
+ preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/',$aMatch[1],$aPolyPoints,PREG_SET_ORDER);
+ }
+ elseif (preg_match('#MULTIPOLYGON\\(\\(\\(([- 0-9.,]+)#',$geometry_as_text,$aMatch))
+ {
+ preg_match_all('/(-?[0-9.]+) (-?[0-9.]+)/',$aMatch[1],$aPolyPoints,PREG_SET_ORDER);
+ }
+ elseif (preg_match('#POINT\\((-?[0-9.]+) (-?[0-9.]+)\\)#',$geometry_as_text,$aMatch))
+ {
+ $iSteps = max(8, min(100, ($fRadius * 40000)^2));
+ $fStepSize = (2*pi())/$iSteps;
+ $aPolyPoints = array();
+ for($f = 0; $f < 2*pi(); $f += $fStepSize)
+ {
+ $aPolyPoints[] = array('',$aMatch[1]+($fRadius*sin($f)),$aMatch[2]+($fRadius*cos($f)));
+ }
+ }
+ return $aPolyPoints;
+ }