]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-html.php
e2799539c896cfbc89d424d48d6382f879dec705
[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                         if (feature) {
50                                 map.zoomToExtent(feature.geometry.getBounds());
51
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: 100
59                                 };
60                                 vectorLayer.addFeatures([feature]);
61                         }
62                 }
63         </script>
64   </head>
65   <body onload="init();">
66     <div id="map"></div>
67 <?php
68         echo '<h1>';
69         if ($aPointDetails['icon'])
70         {
71                 echo '<img style="float:right;margin-right:40px;" src="'.CONST_Website_BaseURL.'images/mapicons/'.$aPointDetails['icon'].'.n.32.png'.'">';
72         }
73         echo $aPointDetails['localname'].'</h1>';
74         echo '<div class="locationdetails">';
75         echo ' <div>Name: ';
76         foreach($aPointDetails['aNames'] as $sKey => $sValue)
77         {
78                 echo ' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>';
79         }
80         echo ' </div>';
81         echo ' <div>Type: <span class="type">'.$aPointDetails['class'].':'.$aPointDetails['type'].'</span></div>';
82         echo ' <div>Last Updated: <span class="type">'.$aPointDetails['indexed_date'].'</span></div>';
83         echo ' <div>Admin Level: <span class="adminlevel">'.$aPointDetails['admin_level'].'</span></div>';
84         echo ' <div>Rank: <span class="rankaddress">'.$aPointDetails['rank_search_label'].'</span></div>';
85         if ($aPointDetails['calculated_importance']) echo ' <div>Importance: <span class="rankaddress">'.$aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)').'</span></div>';
86         echo ' <div>Coverage: <span class="area">'.($aPointDetails['isarea']=='t'?'Polygon':'Point').'</span></div>';
87         $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
88         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>';
89         if ($aPointDetails['wikipedia'])
90         {
91                 list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aPointDetails['wikipedia']);
92                 echo ' <div>Wikipedia Calculated: <span class="wikipedia"><a href="http://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'">'.$aPointDetails['wikipedia'].'</a></span></div>';
93         }
94         echo ' <div>Extra Tags: ';
95         foreach($aPointDetails['aExtraTags'] as $sKey => $sValue)
96         {
97                 echo ' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>';
98         }
99         echo ' </div>';
100         echo '</div>';
101
102         echo '<h2>Address</h2>';
103         echo '<div class="address">';
104         $iPrevRank = 1000000;
105         $sPrevLocalName = '';
106         foreach($aAddressLines as $aAddressLine)
107         {       
108                 $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
109
110                 echo '<div class="line'.($aAddressLine['isaddress']=='f'?' notused':'').'">';
111                 if (!($iPrevRank<=$aAddressLine['rank_address'] || $sPrevLocalName == $aAddressLine['localname']))
112                 {
113                         $iPrevRank = $aAddressLine['rank_address'];
114                         $sPrevLocalName = $aAddressLine['localname'];
115                 }
116                 echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
117                 echo ' (';
118                 echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
119                 if ($sOSMType) echo ', <span class="osm">'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
120                 if (isset($aAddressLine['admin_level'])) echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
121                 if (isset($aAddressLine['rank_search_label'])) echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
122 //              echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
123                 echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
124                 echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
125                 echo ')';
126                 echo '</div>';
127         }
128         echo '</div>';
129
130         if ($aLinkedLines)
131         {
132                 echo '<h2>Linked Places</h2>';
133                 echo '<div class=\"linked\">';
134                 foreach($aLinkedLines as $aAddressLine)
135                 {       
136                         $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
137
138                         echo '<div class="line">';
139                         echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
140                         echo ' (';
141                         echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
142                         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>';
143                         echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
144                         echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
145 //                      echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
146                         echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
147                         echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
148                         echo ')';
149                         echo '</div>';
150                 }
151                 echo '</div>';
152         }
153
154         if ($aPlaceSearchNameKeywords)
155         {
156                 echo '<h2>Name Keywords</h2>';
157                 foreach($aPlaceSearchNameKeywords as $aRow)
158                 {
159                         echo '<div>'.$aRow['word_token'].'</div>';
160                 }
161         }
162
163         if ($aPlaceSearchAddressKeywords)
164         {
165                 echo '<h2>Address Keywords</h2>';
166                 foreach($aPlaceSearchAddressKeywords as $aRow)
167                 {
168                         echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'.'</div>';
169                 }
170         }
171
172         if (sizeof($aParentOfLines))
173         {
174                 echo '<h2>Parent Of:</h2>';
175
176                 $aGroupedAddressLines = array();
177                 foreach($aParentOfLines as $aAddressLine)
178                 {
179                         if (!isset($aGroupedAddressLines[$aAddressLine['type']])) $aGroupedAddressLines[$aAddressLine['type']] = array();
180                         $aGroupedAddressLines[$aAddressLine['type']][] = $aAddressLine;
181                 }
182                 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
183                 {
184                         $sGroupHeading = ucwords($sGroupHeading);
185                         echo "<h3>$sGroupHeading</h3>";
186                 foreach($aParentOfLines as $aAddressLine)
187                 {
188                         $aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
189                         $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
190         
191                         echo '<div class="line">';
192                         echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
193                         echo ' (';
194 //                      echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
195 //                      echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
196 //                      echo ', <span class="rankaddress">'.$aAddressLine['rank_address'].'</span>';
197                         echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>';
198                         echo ', <span class="distance">~'.(round($aAddressLine['distance']*69,1)).'&nbsp;miles</span>';
199                         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>';
200                         echo ', <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
201                         echo ')';
202                         echo '</div>';
203                 }
204                 }
205                 if (sizeof($aParentOfLines) >= 500) {
206                         echo '<p>There are more child objects which are not shown.</p>';
207                 }
208                 echo '</div>';
209         }
210
211 //      echo '<h2>Other Parts:</h2>';
212 //      echo '<h2>Linked To:</h2>';
213 ?>
214
215   </body>
216 </html>