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