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