]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-html.php
Include the centre point on the details page
[nominatim.git] / lib / template / details-html.php
1 <?php
2         header("content-type: text/html; charset=UTF-8");
3 ?>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6   <head>
7     <title>OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?></title>
8     <link href="css/details.css" rel="stylesheet" type="text/css" />
9         <script src="js/OpenLayers.js" type="text/javascript"></script>
10         <script src="js/tiles.js" type="text/javascript"></script>
11         <script type="text/javascript">
12
13                 var map;
14
15     function init() {
16                         map = new OpenLayers.Map ("map", {
17                 controls:[
18                                                                                 new OpenLayers.Control.Permalink(),
19                                                                                 new OpenLayers.Control.Navigation(),
20                                                                                 new OpenLayers.Control.PanZoomBar(),
21                                                                                 new OpenLayers.Control.MouseDefaults(),
22                                                                                 new OpenLayers.Control.MousePosition(),
23                                                                                 new OpenLayers.Control.Attribution()],
24                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
25                 maxResolution: 156543.0399,
26                 numZoomLevels: 19,
27                 units: 'm',
28                 projection: new OpenLayers.Projection("EPSG:900913"),
29                 displayProjection: new OpenLayers.Projection("EPSG:4326")
30                 } );
31                         map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default"));
32
33                         var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
34                         layer_style.fillOpacity = 0.2;
35                         layer_style.graphicOpacity = 0.2;
36
37                         vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
38                         map.addLayer(vectorLayer);
39
40                         var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
41                         var proj_map = map.getProjectionObject();
42
43                         freader = new OpenLayers.Format.WKT({
44                                 'internalProjection': proj_map,
45                                 'externalProjection': proj_EPSG4326
46                         });
47
48                         var feature = freader.read('<?php echo $aPointDetails['outlinestring'];?>');
49                         var featureCentre = freader.read('POINT(<?php echo $aPointDetails['lon'];?> <?php echo $aPointDetails['lat'];?>)');
50                         if (feature) {
51                                 map.zoomToExtent(feature.geometry.getBounds());
52                                 feature.style = {
53                                         strokeColor: "#75ADFF",
54                                         fillColor: "#F0F7FF",
55                                         strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
56                                         strokeOpacity: 0.75,
57                                         fillOpacity: 0.75,
58                                         pointRadius: 50
59                                 };
60
61 <?php if ($aPointDetails['isarea']=='t') {?>
62                                 featureCentre.style = {
63                                         strokeColor: "#008800",
64                                         fillColor: "#338833",
65                                         strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
66                                         strokeOpacity: 0.75,
67                                         fillOpacity: 0.75,
68                                         pointRadius: 8
69                                 };
70                                 vectorLayer.addFeatures([feature,featureCentre]);
71 <?php } else { ?>
72                                 vectorLayer.addFeatures([feature]);
73 <?php } ?>
74                         }
75                 }
76         </script>
77   </head>
78   <body onload="init();">
79     <div id="map"></div>
80 <?php
81         echo '<h1>';
82         if ($aPointDetails['icon'])
83         {
84                 echo '<img style="float:right;margin-right:40px;" src="'.CONST_Website_BaseURL.'images/mapicons/'.$aPointDetails['icon'].'.n.32.png'.'">';
85         }
86         echo $aPointDetails['localname'].'</h1>';
87         echo '<div class="locationdetails">';
88         echo ' <div>Name: ';
89         foreach($aPointDetails['aNames'] as $sKey => $sValue)
90         {
91                 echo ' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>';
92         }
93         echo ' </div>';
94         echo ' <div>Type: <span class="type">'.$aPointDetails['class'].':'.$aPointDetails['type'].'</span></div>';
95         echo ' <div>Last Updated: <span class="type">'.$aPointDetails['indexed_date'].'</span></div>';
96         echo ' <div>Admin Level: <span class="adminlevel">'.$aPointDetails['admin_level'].'</span></div>';
97         echo ' <div>Rank: <span class="rankaddress">'.$aPointDetails['rank_search_label'].'</span></div>';
98         if ($aPointDetails['calculated_importance']) echo ' <div>Importance: <span class="rankaddress">'.$aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)').'</span></div>';
99         echo ' <div>Coverage: <span class="area">'.($aPointDetails['isarea']=='t'?'Polygon':'Point').'</span></div>';
100         echo ' <div>Centre Point: <span class="area">'.$aPointDetails['lat'].','.$aPointDetails['lon'].'</span></div>';
101         $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
102         if ($sOSMType) echo ' <div>OSM: <span class="osm">'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPointDetails['osm_id'].'">'.$aPointDetails['osm_id'].'</a></span></div>';
103         if ($aPointDetails['wikipedia'])
104         {
105                 list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aPointDetails['wikipedia']);
106                 echo ' <div>Wikipedia Calculated: <span class="wikipedia"><a href="http://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'">'.$aPointDetails['wikipedia'].'</a></span></div>';
107         }
108         echo ' <div>Extra Tags: ';
109         foreach($aPointDetails['aExtraTags'] as $sKey => $sValue)
110         {
111                 echo ' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>';
112         }
113         echo ' </div>';
114         echo '</div>';
115
116         echo '<h2>Address</h2>';
117         echo '<div class="address">';
118         $iPrevRank = 1000000;
119         $sPrevLocalName = '';
120         foreach($aAddressLines as $aAddressLine)
121         {       
122                 $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
123
124                 echo '<div class="line'.($aAddressLine['isaddress']=='f'?' notused':'').'">';
125                 if (!($iPrevRank<=$aAddressLine['rank_address'] || $sPrevLocalName == $aAddressLine['localname']))
126                 {
127                         $iPrevRank = $aAddressLine['rank_address'];
128                         $sPrevLocalName = $aAddressLine['localname'];
129                 }
130                 echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
131                 echo ' (';
132                 echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
133                 if ($sOSMType) echo ', <span class="osm">'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
134                 if (isset($aAddressLine['admin_level'])) echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
135                 if (isset($aAddressLine['rank_search_label'])) echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
136 //              echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
137                 echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
138                 echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
139                 echo ')';
140                 echo '</div>';
141         }
142         echo '</div>';
143
144         if ($aLinkedLines)
145         {
146                 echo '<h2>Linked Places</h2>';
147                 echo '<div class=\"linked\">';
148                 foreach($aLinkedLines as $aAddressLine)
149                 {       
150                         $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
151
152                         echo '<div class="line">';
153                         echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
154                         echo ' (';
155                         echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
156                         if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
157                         echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
158                         echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
159 //                      echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
160                         echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
161                         echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
162                         echo ')';
163                         echo '</div>';
164                 }
165                 echo '</div>';
166         }
167
168         if ($aPlaceSearchNameKeywords)
169         {
170                 echo '<h2>Name Keywords</h2>';
171                 foreach($aPlaceSearchNameKeywords as $aRow)
172                 {
173                         echo '<div>'.$aRow['word_token'].'</div>';
174                 }
175         }
176
177         if ($aPlaceSearchAddressKeywords)
178         {
179                 echo '<h2>Address Keywords</h2>';
180                 foreach($aPlaceSearchAddressKeywords as $aRow)
181                 {
182                         echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'.'</div>';
183                 }
184         }
185
186         if (sizeof($aParentOfLines))
187         {
188                 echo '<h2>Parent Of:</h2>';
189
190                 $aGroupedAddressLines = array();
191                 foreach($aParentOfLines as $aAddressLine)
192                 {
193                         if (!isset($aGroupedAddressLines[$aAddressLine['type']])) $aGroupedAddressLines[$aAddressLine['type']] = array();
194                         $aGroupedAddressLines[$aAddressLine['type']][] = $aAddressLine;
195                 }
196                 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
197                 {
198                         $sGroupHeading = ucwords($sGroupHeading);
199                         echo "<h3>$sGroupHeading</h3>";
200                 foreach($aParentOfLines as $aAddressLine)
201                 {
202                         $aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
203                         $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
204         
205                         echo '<div class="line">';
206                         echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
207                         echo ' (';
208 //                      echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
209 //                      echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
210 //                      echo ', <span class="rankaddress">'.$aAddressLine['rank_address'].'</span>';
211                         echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>';
212                         echo ', <span class="distance">~'.(round($aAddressLine['distance']*69,1)).'&nbsp;miles</span>';
213                         if ($sOSMType) echo ', <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
214                         echo ', <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
215                         echo ')';
216                         echo '</div>';
217                 }
218                 }
219                 if (sizeof($aParentOfLines) >= 500) {
220                         echo '<p>There are more child objects which are not shown.</p>';
221                 }
222                 echo '</div>';
223         }
224
225 //      echo '<h2>Other Parts:</h2>';
226 //      echo '<h2>Linked To:</h2>';
227 ?>
228
229   </body>
230 </html>