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" />
9 <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
14 function headline($sTitle)
16 // echo "<h2>".$sTitle."</h2>\n";
17 echo "<tr class='all-columns'><td colspan='6'><h2>".$sTitle."</h2></td></tr>\n";
20 function headline3($sTitle)
22 // echo "<h2>".$sTitle."</h2>\n";
23 echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
26 function osm_link($aFeature)
28 $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
31 return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
36 function wikipedia_link($aFeature)
38 if ($aFeature['wikipedia'])
40 list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
41 return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
46 function nominatim_link($aFeature, $sTitle)
48 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
51 function format_distance($fDistance)
53 // $fDistance is in meters
58 elseif ($fDistance < 1000)
60 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
64 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
68 function kv($sKey,$sValue)
70 echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
74 function hash_to_subtable($aAssociatedList)
77 foreach($aAssociatedList as $sKey => $sValue)
79 $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
84 // function hash_to_subtable($aAssociatedList)
86 // $sHTML = '<table class="table">';
87 // foreach($aAssociatedList as $sKey => $sValue)
89 // $sHTML = $sHTML . '<tr><td>'.$sKey.'</td><td class="name">'.$sValue.'</td></tr>'."\n";
91 // $sHTML = $sHTML . '</table>';
96 function map_icon($sIcon)
99 echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
104 function _one_row($aAddressLine){
105 $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
107 echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
108 echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
109 echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
110 echo ' <td>' . osm_link($aAddressLine) . "</td>\n";
111 echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
112 // echo '<td>' . (isset($aAddressLine['rank_search_label']) ? $aAddressLine['rank_search_label'] : '') ."</td>\n";
113 // echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
114 echo ' <td>' . format_distance($aAddressLine['distance'])."</td>\n";
115 echo ' <td>' . nominatim_link($aAddressLine,'details >') . "</td>\n";
123 <body id="details-page">
124 <div class="container">
126 <div class="col-sm-10">
127 <h1><?php echo $aPointDetails['localname'] ?></h1>
129 <div class="col-sm-2 text-right">
130 <?php map_icon($aPointDetails['icon']) ?>
134 <div class="col-md-6">
135 <table id="locationdetails" class="table table-striped">
139 kv('Name' , hash_to_subtable($aPointDetails['aNames']) );
140 kv('Type' , $aPointDetails['class'].':'.$aPointDetails['type'] );
141 kv('Last Updated' , $aPointDetails['indexed_date'] );
142 kv('Admin Level' , $aPointDetails['admin_level'] );
143 kv('Rank' , $aPointDetails['rank_search_label'] );
144 if ($aPointDetails['calculated_importance']) {
145 kv('Importance' , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
147 kv('Coverage' , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
148 kv('Centre Point' , $aPointDetails['lat'].','.$aPointDetails['lon'] );
149 kv('OSM' , osm_link($aPointDetails) );
150 if ($aPointDetails['wikipedia'])
152 kv('Wikipedia Calculated' , wikipedia_link($aPointDetails) );
155 kv('Extra Tags' , hash_to_subtable($aPointDetails['aExtraTags']) );
162 <div class="col-md-6">
168 <div class="col-md-12">
172 <table id="address" class="table table-striped table-responsive">
179 <!-- <td>Search rank</td> -->
188 foreach($aAddressLines as $aAddressLine)
190 _one_row($aAddressLine);
200 headline('Linked Places');
201 foreach($aLinkedLines as $aAddressLine)
203 _one_row($aAddressLine);
209 if ($aPlaceSearchNameKeywords)
211 headline('Name Keywords');
212 foreach($aPlaceSearchNameKeywords as $aRow)
214 echo '<div>'.$aRow['word_token']."</div>\n";
218 if ($aPlaceSearchAddressKeywords)
220 headline('Address Keywords');
221 foreach($aPlaceSearchAddressKeywords as $aRow)
223 echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'."</div>\n";
227 if (sizeof($aParentOfLines))
229 headline('Parent Of');
231 $aGroupedAddressLines = array();
232 foreach($aParentOfLines as $aAddressLine)
234 if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
235 else $sType = $aAddressLine['type'];
237 if (!isset($aGroupedAddressLines[$sType]))
238 $aGroupedAddressLines[$sType] = array();
239 $aGroupedAddressLines[$sType][] = $aAddressLine;
241 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
243 $sGroupHeading = ucwords($sGroupHeading);
244 headline3($sGroupHeading);
246 foreach($aParentOfLines as $aAddressLine)
248 _one_row($aAddressLine);
251 if (sizeof($aParentOfLines) >= 500) {
252 echo '<p>There are more child objects which are not shown.</p>';
256 // headline('Other Parts');
257 // headline('Linked To');
266 <script type="text/javascript">
268 var nominatim_result = {
269 outlinestring: '<?php echo $aPointDetails['outlinestring'];?>',
270 lon: <?php echo $aPointDetails['lon'];?>,
271 lat: <?php echo $aPointDetails['lat'];?>,
278 <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>