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" />
13 function headline($sTitle)
15 echo "<h2>".$sTitle."</h2>\n";
18 function osm_link($aFeature)
20 $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
23 return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
28 function wikipedia_link($aFeature)
30 if ($aFeature['wikipedia'])
32 list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
33 return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
38 function nominatim_link($aFeature, $sTitle)
40 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
43 function format_distance($fDistance)
45 // $fDistance is in meters
50 elseif ($fDistance < 1000)
52 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
56 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
60 function kv($sKey,$sValue)
62 echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
66 function hash_to_subtable($aAssociatedList)
69 foreach($aAssociatedList as $sKey => $sValue)
71 $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
76 // function hash_to_subtable($aAssociatedList)
78 // $sHTML = '<table class="table">';
79 // foreach($aAssociatedList as $sKey => $sValue)
81 // $sHTML = $sHTML . '<tr><td>'.$sKey.'</td><td class="name">'.$sValue.'</td></tr>'."\n";
83 // $sHTML = $sHTML . '</table>';
88 function map_icon($sIcon)
91 echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
96 function _one_row($aAddressLine){
97 $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
99 echo '<tr class="' . ($bNotUsed?'notused':'') . '">';
100 echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</td>';
101 echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . '</td>';
102 echo ' <td>' . osm_link($aAddressLine) . '</td>';
103 echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . '</td>';
104 // echo '<td>' . (isset($aAddressLine['rank_search_label']) ? $aAddressLine['rank_search_label'] : '') .'</td>';
105 // echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
106 echo ' <td>' . format_distance($aAddressLine['distance']).'</td>';;
107 echo ' <td>' . nominatim_link($aAddressLine,'details >') . '</td>';;
115 <body id="details-page">
116 <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
117 <div class="container">
119 <div class="col-sm-10">
120 <h1><?php echo $aPointDetails['localname'] ?></h1>
122 <div class="col-sm-2 text-right">
123 <?php map_icon($aPointDetails['icon']) ?>
127 <div class="col-md-6">
128 <table id="locationdetails" class="table table-striped">
132 kv('Name' , hash_to_subtable($aPointDetails['aNames']) );
133 kv('Type' , $aPointDetails['class'].':'.$aPointDetails['type'] );
134 kv('Last Updated' , $aPointDetails['indexed_date'] );
135 kv('Admin Level' , $aPointDetails['admin_level'] );
136 kv('Rank' , $aPointDetails['rank_search_label'] );
137 if ($aPointDetails['calculated_importance']) {
138 kv('Importance' , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
140 kv('Coverage' , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
141 kv('Centre Point' , $aPointDetails['lat'].','.$aPointDetails['lon'] );
142 kv('OSM' , osm_link($aPointDetails) );
143 if ($aPointDetails['wikipedia'])
145 kv('Wikipedia Calculated' , wikipedia_link($aPointDetails) );
148 kv('Extra Tags' , hash_to_subtable($aPointDetails['aExtraTags']) );
155 <div class="col-md-6">
161 <div class="col-md-12">
165 <table id="address" class="table table-striped table-responsive">
172 <!-- <td>Search rank</td> -->
181 foreach($aAddressLines as $aAddressLine)
183 _one_row($aAddressLine);
195 headline('Linked Places');
196 echo '<table id="linked" class="table table-striped table-responsive">';
197 foreach($aLinkedLines as $aAddressLine)
199 _one_row($aAddressLine);
206 if ($aPlaceSearchNameKeywords)
208 headline('Name Keywords');
209 foreach($aPlaceSearchNameKeywords as $aRow)
211 echo '<div>'.$aRow['word_token']."</div>\n";
215 if ($aPlaceSearchAddressKeywords)
217 headline('Address Keywords');
218 foreach($aPlaceSearchAddressKeywords as $aRow)
220 echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'."</div>\n";
224 if (sizeof($aParentOfLines))
226 headline('Parent Of');
228 $aGroupedAddressLines = array();
229 foreach($aParentOfLines as $aAddressLine)
231 if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
232 else $sType = $aAddressLine['type'];
234 if (!isset($aGroupedAddressLines[$sType]))
235 $aGroupedAddressLines[$sType] = array();
236 $aGroupedAddressLines[$sType][] = $aAddressLine;
238 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
240 $sGroupHeading = ucwords($sGroupHeading);
241 echo "<h3>$sGroupHeading</h3>\n";
243 echo '<table id="linked" class="table table-striped table-responsive">';
244 foreach($aParentOfLines as $aAddressLine)
246 _one_row($aAddressLine);
250 if (sizeof($aParentOfLines) >= 500) {
251 echo '<p>There are more child objects which are not shown.</p>';
255 // headline('Other Parts');
256 // headline('Linked To');
263 <script type="text/javascript">
266 $aNominatimMapInit = [
267 'tile_url' => $sTileURL,
268 'tile_attribution' => $sTileAttribution
270 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
273 'outlinestring' => $aPointDetails['outlinestring'],
274 'lon' => $aPointDetails['lon'],
275 'lat' => $aPointDetails['lat'],
277 echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';';
285 <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>