mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-10 21:04:07 +00:00
factor out link formatting function and osm type translation
This commit is contained in:
43
lib/output.php
Normal file
43
lib/output.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function formatOSMType($sType, $bIncludeExternal=true)
|
||||||
|
{
|
||||||
|
if ($sType == 'N') return 'node';
|
||||||
|
if ($sType == 'W') return 'way';
|
||||||
|
if ($sType == 'R') return 'relation';
|
||||||
|
|
||||||
|
if (!$bIncludeExternal) return '';
|
||||||
|
|
||||||
|
if ($sType == 'T') return 'tiger';
|
||||||
|
if ($sType == 'I') return 'way';
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (!$aFeature['place_id']) return '';
|
||||||
|
|
||||||
|
return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.($sTitle?$sTitle:$aFeature['place_id']).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
@@ -12,8 +12,7 @@
|
|||||||
{
|
{
|
||||||
if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
if (isset($aPlace['place_id'])) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
||||||
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
||||||
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':
|
$sOSMType = formatOSMType($aPlace['osm_type']);
|
||||||
($aPlace['osm_type'] == 'T'?'tiger':($aPlace['osm_type'] == 'I'?'interpolation':'')))));
|
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aFilteredPlaces['osm_type'] = $sOSMType;
|
$aFilteredPlaces['osm_type'] = $sOSMType;
|
||||||
@@ -50,8 +49,6 @@
|
|||||||
{
|
{
|
||||||
$aFilteredPlaces['geokml'] = $aPlace['askml'];
|
$aFilteredPlaces['geokml'] = $aPlace['askml'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
javascript_renderData($aFilteredPlaces);
|
javascript_renderData($aFilteredPlaces);
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
{
|
{
|
||||||
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
if ($aPlace['place_id']) $aFilteredPlaces['place_id'] = $aPlace['place_id'];
|
||||||
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
|
||||||
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':
|
$sOSMType = formatOSMType($aPlace['osm_type']);
|
||||||
($aPlace['osm_type'] == 'T'?'tiger':($aPlace['osm_type'] == 'I'?'interpolation':'')))));
|
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aFilteredPlaces['osm_type'] = $sOSMType;
|
$aFilteredPlaces['osm_type'] = $sOSMType;
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
{
|
{
|
||||||
echo "<result";
|
echo "<result";
|
||||||
if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
|
if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
|
||||||
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':
|
$sOSMType = formatOSMType($aPlace['osm_type']);
|
||||||
($aPlace['osm_type'] == 'T'?'tiger':($aPlace['osm_type'] == 'I'?'interpolation':'')))));
|
|
||||||
if ($sOSMType) echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
|
if ($sOSMType) echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
|
||||||
if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
|
if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
|
||||||
if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
|
if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
|
||||||
|
|||||||
@@ -9,26 +9,21 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function osm_link($aFeature)
|
function osmMapUrl($aFeature)
|
||||||
{
|
|
||||||
$sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
|
|
||||||
if ($sOSMType) {
|
|
||||||
return '<a href="http://www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function osm_map_url($aFeature)
|
|
||||||
{
|
{
|
||||||
$sLon = $aFeature['error_x'];
|
$sLon = $aFeature['error_x'];
|
||||||
$sLat = $aFeature['error_y'];
|
$sLat = $aFeature['error_y'];
|
||||||
|
|
||||||
if (isset($sLat))
|
if (isset($sFeature['error_x']) && isset($sFeature['error_y']))
|
||||||
{
|
{
|
||||||
$sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
|
$sBaseUrl = '//www.openstreetmap.org/';
|
||||||
|
$sOSMType = formatOSMType($aFeature['osm_type'], false);
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
return "http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$aFeature['osm_id'];
|
$sBaseUrl += $sOSMType.'/'.$aFeature['osm_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<a href="'.$sBaseUrl.'?mlat='.$sLat.'&mlon='.$sLon.'">view on osm.org</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@@ -45,7 +40,7 @@
|
|||||||
return "http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth);
|
return "http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
|
$sOSMType = formatOSMType($aFeature['osm_type'], false);
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
return 'http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aFeature['osm_id'].'/full';
|
return 'http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aFeature['osm_id'].'/full';
|
||||||
@@ -63,7 +58,7 @@
|
|||||||
|
|
||||||
if (isset($sLat))
|
if (isset($sLat))
|
||||||
{
|
{
|
||||||
return "http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth);
|
return "//www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -87,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
OSM: <span class="label"><?php echo osm_link($aPointDetails); ?><span>
|
OSM: <span class="label"><?php echo osmLink($aPointDetails); ?><span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -95,9 +90,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<?php echo $aPointDetails['errormessage']?$aPointDetails['errormessage']:'unknown'; ?>
|
<?php echo $aPointDetails['errormessage']?$aPointDetails['errormessage']:'unknown'; ?>
|
||||||
</p>
|
</p>
|
||||||
<?php if (osm_map_url($aPointDetails)) { ?>
|
<?php echo osmMapUrl($aPointDetails); ?>
|
||||||
<a href="<?php echo osm_map_url($aPointDetails); ?>">view on osm.org</a>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<h4>Edit</h4>
|
<h4>Edit</h4>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function headline($sTitle)
|
function headline($sTitle)
|
||||||
@@ -20,30 +19,6 @@
|
|||||||
echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
|
echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function osm_link($aFeature)
|
|
||||||
{
|
|
||||||
$sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
|
|
||||||
if ($sOSMType)
|
|
||||||
{
|
|
||||||
return '<a href="http://www.openstreetmap.org/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function wikipedia_link($aFeature)
|
|
||||||
{
|
|
||||||
if ($aFeature['wikipedia'])
|
|
||||||
{
|
|
||||||
list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
|
|
||||||
return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function nominatim_link($aFeature, $sTitle)
|
|
||||||
{
|
|
||||||
return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function format_distance($fDistance)
|
function format_distance($fDistance)
|
||||||
{
|
{
|
||||||
@@ -92,10 +67,10 @@
|
|||||||
echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
|
echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
|
||||||
echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
|
echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
|
||||||
echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
|
echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
|
||||||
echo ' <td>' . osm_link($aAddressLine) . "</td>\n";
|
echo ' <td>' . osmLink($aAddressLine) . "</td>\n";
|
||||||
echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
|
echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
|
||||||
echo ' <td>' . format_distance($aAddressLine['distance'])."</td>\n";
|
echo ' <td>' . format_distance($aAddressLine['distance'])."</td>\n";
|
||||||
echo ' <td>' . nominatim_link($aAddressLine,'details >') . "</td>\n";
|
echo ' <td>' . detailsLink($aAddressLine,'details >') . "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,10 +118,10 @@
|
|||||||
}
|
}
|
||||||
kv('Coverage' , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
|
kv('Coverage' , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
|
||||||
kv('Centre Point' , $aPointDetails['lat'].','.$aPointDetails['lon'] );
|
kv('Centre Point' , $aPointDetails['lat'].','.$aPointDetails['lon'] );
|
||||||
kv('OSM' , osm_link($aPointDetails) );
|
kv('OSM' , osmLink($aPointDetails) );
|
||||||
if ($aPointDetails['wikipedia'])
|
if ($aPointDetails['wikipedia'])
|
||||||
{
|
{
|
||||||
kv('Wikipedia Calculated' , wikipedia_link($aPointDetails) );
|
kv('Wikipedia Calculated' , wikipediaLink($aPointDetails) );
|
||||||
}
|
}
|
||||||
|
|
||||||
kv('Extra Tags' , hash_to_subtable($aPointDetails['aExtraTags']) );
|
kv('Extra Tags' , hash_to_subtable($aPointDetails['aExtraTags']) );
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
'place_id'=>$aPointDetails['place_id'],
|
'place_id'=>$aPointDetails['place_id'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
|
$sOSMType = formatOSMType($aPointDetails['osm_type']);
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aPlace['osm_type'] = $sOSMType;
|
$aPlace['osm_type'] = $sOSMType;
|
||||||
|
|||||||
@@ -9,8 +9,7 @@
|
|||||||
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
||||||
);
|
);
|
||||||
|
|
||||||
$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?
|
$sOSMType = formatOSMType($aPointDetails['osm_type']);
|
||||||
'relation':($aPointDetails['osm_type'] == 'T'?'tiger':($aPointDetails['osm_type'] == 'I'?'interpolation':'')))));
|
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aPlace['osm_type'] = $sOSMType;
|
$aPlace['osm_type'] = $sOSMType;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
'licence'=>"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
|
||||||
);
|
);
|
||||||
|
|
||||||
$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':($aPointDetails['osm_type'] == 'T'?'tiger':($aPointDetails['osm_type'] == 'I'?'interpolation':'')))));
|
$sOSMType = formatOSMType($aPointDetails['osm_type']);
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
$aPlace['osm_type'] = $sOSMType;
|
$aPlace['osm_type'] = $sOSMType;
|
||||||
|
|||||||
@@ -25,8 +25,7 @@
|
|||||||
foreach($aSearchResults as $iResNum => $aResult)
|
foreach($aSearchResults as $iResNum => $aResult)
|
||||||
{
|
{
|
||||||
echo "<place place_id='".$aResult['place_id']."'";
|
echo "<place place_id='".$aResult['place_id']."'";
|
||||||
$sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':
|
$sOSMType = formatOSMType($aResult['osm_type']);
|
||||||
($aResult['osm_type'] == 'T'?'tiger':($aResult['osm_type'] == 'I'?'interpolation':'')))));
|
|
||||||
if ($sOSMType)
|
if ($sOSMType)
|
||||||
{
|
{
|
||||||
echo " osm_type='$sOSMType'";
|
echo " osm_type='$sOSMType'";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
|
||||||
$sOutputFormat = 'html';
|
$sOutputFormat = 'html';
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
@@ -66,6 +67,7 @@ table td {
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
|
if (!$aPolygons) exit;
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
//var_dump($aPolygons[0]);
|
//var_dump($aPolygons[0]);
|
||||||
foreach($aPolygons[0] as $sCol => $sVal)
|
foreach($aPolygons[0] as $sCol => $sVal)
|
||||||
@@ -81,11 +83,10 @@ table td {
|
|||||||
switch($sCol)
|
switch($sCol)
|
||||||
{
|
{
|
||||||
case 'osm_id':
|
case 'osm_id':
|
||||||
$sOSMType = ($aRow['osm_type'] == 'N'?'node':($aRow['osm_type'] == 'W'?'way':($aRow['osm_type'] == 'R'?'relation':'')));
|
echo '<td>'.osmLink($aRow).'</td>';
|
||||||
echo '<td><a href="http://www.openstreetmap.org/'.$sOSMType.'/'.$sVal.'" target="_new">'.$sVal.'</a></td>';
|
|
||||||
break;
|
break;
|
||||||
case 'place_id':
|
case 'place_id':
|
||||||
echo '<td><a href="'.CONST_Website_BaseURL.'details?place_id='.$sVal.'">'.$sVal.'</a></td>';
|
echo '<td>'.detailsLink($aRow).'</td>';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo "<td>".($sVal?$sVal:' ')."</td>";
|
echo "<td>".($sVal?$sVal:' ')."</td>";
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
|
||||||
$sOutputFormat = 'html';
|
$sOutputFormat = 'html';
|
||||||
/*
|
/*
|
||||||
@@ -173,5 +174,4 @@
|
|||||||
$sTileAttribution = CONST_Map_Tile_Attribution;
|
$sTileAttribution = CONST_Map_Tile_Attribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');
|
include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
@@ -66,12 +67,17 @@
|
|||||||
foreach($aPlaceAddress as $i => $aPlace)
|
foreach($aPlaceAddress as $i => $aPlace)
|
||||||
{
|
{
|
||||||
if (!$aPlace['place_id']) continue;
|
if (!$aPlace['place_id']) continue;
|
||||||
$aBreadcrums[] = array('placeId'=>$aPlace['place_id'], 'osmType'=>$aPlace['osm_type'], 'osmId'=>$aPlace['osm_id'], 'localName'=>$aPlace['localname']);
|
$aBreadcrums[] = array('placeId' => $aPlace['place_id'],
|
||||||
$sPlaceUrl = 'hierarchy.php?place_id='.$aPlace['place_id'];
|
'osmType' => $aPlace['osm_type'],
|
||||||
$sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
|
'osmId' => $aPlace['osm_id'],
|
||||||
$sOSMUrl = 'http://www.openstreetmap.org/'.$sOSMType.'/'.$aPlace['osm_id'];
|
'localName' => $aPlace['localname']);
|
||||||
if ($sOutputFormat == 'html') if ($i) echo " > ";
|
|
||||||
if ($sOutputFormat == 'html') echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> (<a href="'.$sOSMUrl.'">osm</a>)';
|
if ($sOutputFormat == 'html')
|
||||||
|
{
|
||||||
|
$sPlaceUrl = 'hierarchy.php?place_id='.$aPlace['place_id'];
|
||||||
|
if ($i) echo " > ";
|
||||||
|
echo '<a href="'.$sPlaceUrl.'">'.$aPlace['localname'].'</a> ('.osmLink($aPlace).')';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -114,28 +120,29 @@
|
|||||||
|
|
||||||
if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array();
|
if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array();
|
||||||
$aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine;
|
$aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine;
|
||||||
}
|
|
||||||
foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
|
|
||||||
{
|
|
||||||
echo "<h3>$sGroupHeading</h3>";
|
|
||||||
foreach($aParentOfLines as $aAddressLine)
|
|
||||||
{
|
|
||||||
$aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
|
|
||||||
$sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
|
|
||||||
|
|
||||||
echo '<div class="line">';
|
|
||||||
echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
|
|
||||||
echo ' (';
|
|
||||||
echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>';
|
|
||||||
if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
|
|
||||||
echo ', <a href="hierarchy.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
|
|
||||||
echo ', '.$aAddressLine['area'];
|
|
||||||
echo ')';
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sizeof($aParentOfLines) >= 500) {
|
|
||||||
echo '<p>There are more child objects which are not shown.</p>';
|
|
||||||
}
|
|
||||||
echo '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
|
||||||
|
{
|
||||||
|
echo "<h3>$sGroupHeading</h3>";
|
||||||
|
foreach($aParentOfLines as $aAddressLine)
|
||||||
|
{
|
||||||
|
$aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
|
||||||
|
$sOSMType = formatOSMType($aAddressLine['osm_type'], false);
|
||||||
|
|
||||||
|
echo '<div class="line">';
|
||||||
|
echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
|
||||||
|
echo ' (';
|
||||||
|
echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>';
|
||||||
|
if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' '.osmLink($aAddressLine).'</span>';
|
||||||
|
echo ', <a href="hierarchy.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
|
||||||
|
echo ', '.$aAddressLine['area'];
|
||||||
|
echo ')';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sizeof($aParentOfLines) >= 500) {
|
||||||
|
echo '<p>There are more child objects which are not shown.</p>';
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/settings/settings.php');
|
||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
@@ -77,6 +78,7 @@ table td {
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo "<p>Total number of broken polygons: $iTotalBroken</p>";
|
echo "<p>Total number of broken polygons: $iTotalBroken</p>";
|
||||||
|
if (!$aPolygons) exit;
|
||||||
echo "<table>";
|
echo "<table>";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
//var_dump($aPolygons[0]);
|
//var_dump($aPolygons[0]);
|
||||||
@@ -110,8 +112,7 @@ table td {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'id':
|
case 'id':
|
||||||
$sOSMType = ($aRow['type'] == 'N'?'node':($aRow['type'] == 'W'?'way':($aRow['type'] == 'R'?'relation':'')));
|
echo '<td>'.osmLink($aRow).'</td>';
|
||||||
echo '<td><a href="http://www.openstreetmap.org/'.$sOSMType.'/'.$aRow['id'].'" target="_new">'.$aRow['id'].'</a></td>';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo "<td>".($sVal?$sVal:' ')."</td>";
|
echo "<td>".($sVal?$sVal:' ')."</td>";
|
||||||
@@ -130,10 +131,6 @@ table td {
|
|||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// include(CONST_BasePath.'/lib/template/details-'.$sOutputFormat.'.php');
|
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
require_once(CONST_BasePath.'/lib/PlaceLookup.php');
|
||||||
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
require_once(CONST_BasePath.'/lib/ReverseGeocode.php');
|
||||||
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
|
||||||
if (strpos(CONST_BulkUserIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false)
|
if (strpos(CONST_BulkUserIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
require_once(CONST_BasePath.'/lib/init-website.php');
|
require_once(CONST_BasePath.'/lib/init-website.php');
|
||||||
require_once(CONST_BasePath.'/lib/log.php');
|
require_once(CONST_BasePath.'/lib/log.php');
|
||||||
require_once(CONST_BasePath.'/lib/Geocode.php');
|
require_once(CONST_BasePath.'/lib/Geocode.php');
|
||||||
|
require_once(CONST_BasePath.'/lib/output.php');
|
||||||
|
|
||||||
ini_set('memory_limit', '200M');
|
ini_set('memory_limit', '200M');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user