2 header("content-type: text/html; charset=UTF-8");
4 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
5 <link href="css/details.css" rel="stylesheet" type="text/css" />
12 function headline($sTitle)
14 echo "<h2>".$sTitle."</h2>\n";
17 function osm_link($aFeature)
19 $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
21 return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
26 function wikipedia_link($aFeature)
28 if ($aFeature['wikipedia'])
30 list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
31 return '<a href="http://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'">'.$aFeature['wikipedia'].'</a>';
36 function nominatim_link($aFeature, $sTitle)
38 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
41 function format_distance($fDistance)
43 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,1)).' km</abbr>';
46 function kv($sKey,$sValue)
48 echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
52 function hash_to_subtable($aAssociatedList)
55 foreach($aAssociatedList as $sKey => $sValue)
57 $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
62 // function hash_to_subtable($aAssociatedList)
64 // $sHTML = '<table class="table">';
65 // foreach($aAssociatedList as $sKey => $sValue)
67 // $sHTML = $sHTML . '<tr><td>'.$sKey.'</td><td class="name">'.$sValue.'</td></tr>'."\n";
69 // $sHTML = $sHTML . '</table>';
74 function map_icon($sIcon)
77 echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
82 function _one_row($aAddressLine){
83 $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
85 echo '<tr class="' . ($bNotUsed?'notused':'') . '">';
86 echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</td>';
87 echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . '</td>';
88 echo ' <td>' . osm_link($aAddressLine) . '</td>';
89 echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . '</td>';
90 // echo '<td>' . (isset($aAddressLine['rank_search_label']) ? $aAddressLine['rank_search_label'] : '') .'</td>';
91 // echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
92 echo ' <td>' . format_distance($aAddressLine['distance']).'</td>';;
93 echo ' <td>' . nominatim_link($aAddressLine,'details >') . '</td>';;
101 <body id="details-page">
102 <div class="container">
104 <div class="col-sm-10">
105 <h1><?php echo $aPointDetails['localname'] ?></h1>
107 <div class="col-sm-2 text-right">
108 <?php map_icon($aPointDetails['icon']) ?>
112 <div class="col-md-6">
113 <table id="locationdetails" class="table table-striped">
117 kv('Name' , hash_to_subtable($aPointDetails['aNames']) );
118 kv('Type' , $aPointDetails['class'].':'.$aPointDetails['type'] );
119 kv('Last Updated' , $aPointDetails['indexed_date'] );
120 kv('Admin Level' , $aPointDetails['admin_level'] );
121 kv('Rank' , $aPointDetails['rank_search_label'] );
122 if ($aPointDetails['calculated_importance']) {
123 kv('Importance' , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
125 kv('Coverage' , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
126 kv('Centre Point' , $aPointDetails['lat'].','.$aPointDetails['lon'] );
127 kv('OSM' , osm_link($aPointDetails) );
128 if ($aPointDetails['wikipedia'])
130 kv('Wikipedia Calculated' , wikipedia_link($aPointDetails) );
133 kv('Extra Tags' , hash_to_subtable($aPointDetails['aExtraTags']) );
140 <div class="col-md-6">
146 <div class="col-md-12">
150 <table id="address" class="table table-striped table-responsive">
157 <!-- <td>Search rank</td> -->
166 foreach($aAddressLines as $aAddressLine)
168 _one_row($aAddressLine);
180 headline('Linked Places');
181 echo '<table id="linked" class="table table-striped table-responsive">';
182 foreach($aLinkedLines as $aAddressLine)
184 _one_row($aAddressLine);
191 if ($aPlaceSearchNameKeywords)
193 headline('Name Keywords');
194 foreach($aPlaceSearchNameKeywords as $aRow)
196 echo '<div>'.$aRow['word_token']."</div>\n";
200 if ($aPlaceSearchAddressKeywords)
202 headline('Address Keywords');
203 foreach($aPlaceSearchAddressKeywords as $aRow)
205 echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'."</div>\n";
209 if (sizeof($aParentOfLines))
211 headline('Parent Of');
213 $aGroupedAddressLines = array();
214 foreach($aParentOfLines as $aAddressLine)
216 if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
217 else $sType = $aAddressLine['type'];
219 if (!isset($aGroupedAddressLines[$sType]))
220 $aGroupedAddressLines[$sType] = array();
221 $aGroupedAddressLines[$sType][] = $aAddressLine;
223 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
225 $sGroupHeading = ucwords($sGroupHeading);
226 echo "<h3>$sGroupHeading</h3>\n";
228 echo '<table id="linked" class="table table-striped table-responsive">';
229 foreach($aParentOfLines as $aAddressLine)
231 _one_row($aAddressLine);
235 if (sizeof($aParentOfLines) >= 500) {
236 echo '<p>There are more child objects which are not shown.</p>';
240 // headline('Other Parts');
241 // headline('Linked To');
249 <p class="copyright">
250 © <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
255 <script type="text/javascript">
257 var nominatim_result = {
258 outlinestring: '<?php echo $aPointDetails['outlinestring'];?>',
259 lon: <?php echo $aPointDetails['lon'];?>,
260 lat: <?php echo $aPointDetails['lat'];?>,
267 <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>