2     header("content-type: text/html; charset=UTF-8");
 
   4 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
 
   5     <link href="css/common.css" rel="stylesheet" type="text/css" />
 
   6     <link href="css/details.css" rel="stylesheet" type="text/css" />
 
  12     function headline($sTitle)
 
  14         echo "<tr class='all-columns'><td colspan='6'><h2>".$sTitle."</h2></td></tr>\n";
 
  17     function headline3($sTitle)
 
  19         echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
 
  23     function format_distance($fDistance, $bInMeters = false)
 
  26             // $fDistance is in meters
 
  30             elseif ($fDistance < 1000) {
 
  31                 return '<abbr class="distance" title="'.$fDistance.' meters">~'.(round($fDistance,0)).' m</abbr>';
 
  34                 return '<abbr class="distance" title="'.$fDistance.' meters">~'.(round($fDistance/1000,1)).' km</abbr>';
 
  37             if ($fDistance == 0) {
 
  40                 return '<abbr class="distance" title="spheric distance '.$fDistance.'">'.(round($fDistance,4)).'</abbr>';
 
  45     function kv($sKey,$sValue)
 
  47         echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
 
  51     function hash_to_subtable($aAssociatedList)
 
  54         foreach ($aAssociatedList as $sKey => $sValue) {
 
  55             $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
 
  60     function map_icon($sIcon)
 
  63             echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
 
  68     function _one_row($aAddressLine, $bDistanceInMeters = false){
 
  69         $bNotUsed = isset($aAddressLine['isaddress']) && !$aAddressLine['isaddress'];
 
  71         echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
 
  72         echo '  <td class="name">'.(trim($aAddressLine['localname'])!==null?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
 
  73         echo '  <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
 
  74         echo '  <td>' . osmLink($aAddressLine) . "</td>\n";
 
  75         echo '  <td>' . (isset($aAddressLine['rank_address']) ? $aAddressLine['rank_address'] : '') . "</td>\n";
 
  76         echo '  <td>' . ($aAddressLine['admin_level'] < 15 ? $aAddressLine['admin_level'] : '') . "</td>\n";
 
  77         echo '  <td>' . format_distance($aAddressLine['distance'], $bDistanceInMeters)."</td>\n";
 
  78         echo '  <td>' . detailsPermaLink($aAddressLine,'details >') . "</td>\n";
 
  82     function _one_keyword_row($keyword_token,$word_id){
 
  85         // mark partial tokens (those starting with a space) with a star for readability
 
  86         echo ($keyword_token[0]==' '?'*':'');
 
  90             echo '</td><td>word id: '.$word_id;
 
  99 <body id="details-page">
 
 100     <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
 
 101     <div class="container">
 
 103             <div class="col-sm-10">
 
 105                     <?php echo $aPointDetails['localname'] ?>
 
 108             <div class="col-sm-2 text-right">
 
 109                 <?php map_icon($aPointDetails['icon']) ?>
 
 113             <div class="col-md-6">
 
 114                 <table id="locationdetails" class="table table-striped">
 
 118                     kv('Name'            , hash_to_subtable($aPointDetails['aNames']) );
 
 119                     kv('Type'            , $aPointDetails['class'].':'.$aPointDetails['type'] );
 
 120                     kv('Last Updated'    , (new DateTime('@'.$aPointDetails['indexed_epoch']))->format(DateTime::RFC822) );
 
 121                     kv('Admin Level'     , $aPointDetails['admin_level'] );
 
 122                     kv('Rank'            , $aPointDetails['rank_search_label'] );
 
 123                     if ($aPointDetails['calculated_importance']) {
 
 124                         kv('Importance'    , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
 
 126                     kv('Coverage'        , ($aPointDetails['isarea']?'Polygon':'Point') );
 
 127                     kv('Centre Point'    , $aPointDetails['lat'].','.$aPointDetails['lon'] );
 
 128                     kv('OSM'             , osmLink($aPointDetails) );
 
 129                     kv('Place Id (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)'
 
 130                                          , $aPointDetails['place_id'] );
 
 131                     if ($aPointDetails['wikipedia'])
 
 133                         kv('Wikipedia Calculated' , wikipediaLink($aPointDetails) );
 
 136                     kv('Computed Postcode', $aPointDetails['postcode']);
 
 137                     kv('Address Tags'    , hash_to_subtable($aPointDetails['aAddressTags']) );
 
 138                     kv('Extra Tags'      , hash_to_subtable($aPointDetails['aExtraTags']) );
 
 145             <div class="col-md-6">
 
 151             <div class="col-md-12">
 
 155             <table id="address" class="table table-striped table-responsive">
 
 161                       <td>Address rank</td>
 
 170                     foreach ($aAddressLines as $aAddressLine) {
 
 171                         _one_row($aAddressLine);
 
 180         headline('Linked Places');
 
 181         foreach ($aLinkedLines as $aAddressLine) {
 
 182             _one_row($aAddressLine, true);
 
 186     if ($bIncludeKeywords)
 
 188         headline('Name Keywords');
 
 189         if ($aPlaceSearchNameKeywords) {
 
 190             foreach ($aPlaceSearchNameKeywords as $aRow) {
 
 191                 _one_keyword_row($aRow['word_token'], $aRow['word_id']);
 
 195         headline('Address Keywords');
 
 196         if ($aPlaceSearchAddressKeywords) {
 
 197             foreach ($aPlaceSearchAddressKeywords as $aRow) {
 
 198                 _one_keyword_row($aRow['word_token'], $aRow['word_id']);
 
 203     if (!empty($aHierarchyLines))
 
 205         headline('Parent Of');
 
 207         $aGroupedAddressLines = array();
 
 208         foreach ($aHierarchyLines as $aAddressLine) {
 
 209             if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
 
 210             else $sType = $aAddressLine['type'];
 
 212             if (!isset($aGroupedAddressLines[$sType]))
 
 213                 $aGroupedAddressLines[$sType] = array();
 
 214             $aGroupedAddressLines[$sType][] = $aAddressLine;
 
 216         foreach ($aGroupedAddressLines as $sGroupHeading => $aHierarchyLines) {
 
 217             $sGroupHeading = ucwords($sGroupHeading);
 
 218             headline3($sGroupHeading);
 
 220             foreach ($aHierarchyLines as $aAddressLine) {
 
 221                 _one_row($aAddressLine, true);
 
 224         if (count($aHierarchyLines) >= 500) {
 
 225             echo '<p>There are more child objects which are not shown.</p>';
 
 236     <script type="text/javascript">
 
 239         $aNominatimMapInit = array(
 
 240           'tile_url' => $sTileURL,
 
 241           'tile_attribution' => $sTileAttribution
 
 243         echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
 
 246                 'asgeojson' => $aPointDetails['asgeojson'],
 
 247                 'lon' => $aPointDetails['lon'],
 
 248                 'lat' => $aPointDetails['lat'],
 
 250         echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';';
 
 258     <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>