]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-html.php
output importance on details.php page
[nominatim.git] / lib / template / details-html.php
1 <?php
2         header("content-type: text/html; charset=UTF-8");
3 ?>
4 <html>
5   <head>
6     <title>OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?></title>
7     <style>
8 body {
9         margin:0px;
10         padding:16px;
11   background:#ffffff;
12   height: 100%;
13   font: normal 12px/15px arial,sans-serif;
14 }
15 .line{
16   margin-left:20px;
17 }
18 .name{
19   font-weight: bold;
20 }
21 .notused{
22   color:#ddd;
23 }
24 .noname{
25   color:#800;
26 }
27 #map {
28   width:500px;
29   height:500px;
30   border: 2px solid #666;
31   float: right;
32 }
33     </style>
34         <script src="js/OpenLayers.js"></script>
35         <script src="js/OpenStreetMap.js"></script>
36         <script src="prototype-1.6.0.3.js"></script>
37         <script type="text/javascript">
38         
39                 var map;
40
41     function init() {
42                         map = new OpenLayers.Map ("map", {
43                 controls:[
44                                                                                 new OpenLayers.Control.Permalink(),
45                                                                                 new OpenLayers.Control.Navigation(),
46                                                                                 new OpenLayers.Control.PanZoomBar(),
47                                                                                 new OpenLayers.Control.MouseDefaults(),
48                                                                                 new OpenLayers.Control.MousePosition(),
49                                                                                 new OpenLayers.Control.Attribution()],
50                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
51                 maxResolution: 156543.0399,
52                 numZoomLevels: 19,
53                 units: 'm',
54                 projection: new OpenLayers.Projection("EPSG:900913"),
55                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
56                 } );
57                         map.addLayer(new OpenLayers.Layer.OSM.Mapnik("Mapnik"));
58
59                         var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
60                         layer_style.fillOpacity = 0.2;
61                         layer_style.graphicOpacity = 0.2;
62
63                         vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
64                         map.addLayer(vectorLayer);
65
66                         var pointList = [];
67                         var style = {
68                                 strokeColor: "#75ADFF",
69                                 fillColor: "#F0F7FF",
70                                 strokeWidth: 2,
71                                 strokeOpacity: 0.75,
72                                 fillOpacity: 0.75,
73                         };
74                         var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
75                         var proj_map = map.getProjectionObject();
76                         var latlon;
77 <?php
78 foreach($aPolyPoints as $aPolyPoint)
79 {
80         echo "                        pointList.push(new OpenLayers.Geometry.Point(".$aPolyPoint[1].",".$aPolyPoint[2]."));\n";
81 }
82 ?>
83                         var linearRing = new OpenLayers.Geometry.LinearRing(pointList).transform(proj_EPSG4326, proj_map);;
84                         var polygonFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([linearRing]),null,style);
85                         vectorLayer.addFeatures([polygonFeature]);
86
87                         map.zoomToExtent(new OpenLayers.Bounds(<?php echo $aPointPolygon['minlon']?>, <?php echo $aPointPolygon['minlat']?>, <?php echo $aPointPolygon['maxlon']?>, <?php echo $aPointPolygon['maxlat']?>).transform(proj_EPSG4326, proj_map));
88                 }
89                 
90         </script>
91   </head>
92   <body onload="init();">
93     <div id="map"></div>
94 <?php
95         echo '<h1>';
96         if ($aPointDetails['icon'])
97         {
98                 echo '<img style="float:right;margin-right:40px;" src="'.'http://katie.openstreetmap.org/~twain/images/mapicons/'.$aPointDetails['icon'].'.n.32.png'.'">';
99         }
100         echo $aPointDetails['localname'].'</h1>';
101         echo '<div class="locationdetails">';
102         echo ' <div>Name: ';
103         foreach($aPointDetails['aNames'] as $sKey => $sValue)
104         {
105                 echo ' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>';
106         }
107         echo ' </div>';
108         echo ' <div>Type: <span class="type">'.$aPointDetails['class'].':'.$aPointDetails['type'].'</span></div>';
109         echo ' <div>Admin Level: <span class="adminlevel">'.$aPointDetails['admin_level'].'</span></div>';
110         echo ' <div>Rank: <span class="rankaddress">'.$aPointDetails['rank_search_label'].'</span></div>';
111         if ($aPointDetails['importance']) echo ' <div>Importance: <span class="rankaddress">'.$aPointDetails['importance'].'</span></div>';
112         echo ' <div>Coverage: <span class="area">'.($aPointDetails['isarea']=='t'?'Polygon':'Point').'</span></div>';
113         $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
114         if ($sOSMType) echo ' <div>OSM: <span class="osm"><span class="label"></span>'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPointDetails['osm_id'].'">'.$aPointDetails['osm_id'].'</a></span></div>';
115         echo ' <div>Extra Tags: ';
116         foreach($aPointDetails['aExtraTags'] as $sKey => $sValue)
117         {
118                 echo ' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>';
119         }
120         echo ' </div>';
121         echo '</div>';
122
123         echo '<h2>Address</h2>';
124         echo '<div class=\"address\">';
125         $iPrevRank = 1000000;
126         $sPrevLocalName = '';
127         foreach($aAddressLines as $aAddressLine)
128         {       
129                 $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
130
131                 echo '<div class="line'.($aAddressLine['isaddress']=='f'?' notused':'').'">';
132                 if (!($iPrevRank<=$aAddressLine['rank_address'] || $sPrevLocalName == $aAddressLine['localname']))
133                 {
134                         $iPrevRank = $aAddressLine['rank_address'];
135                         $sPrevLocalName = $aAddressLine['localname'];
136                 }
137                 echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
138                 echo ' (';
139                 echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
140                 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>';
141                 echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
142                 echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
143                 echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
144                 echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';
145                 echo ' <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
146                 echo ')';
147                 echo '</div>';
148         }
149         echo '</div>';
150
151         if (sizeof($aParentOfLines))
152         {
153                 echo '<h2>Parent Of (named features only):</h2>';
154
155                 $aGroupedAddressLines = array();
156                 foreach($aParentOfLines as $aAddressLine)
157                 {
158                         if (!isset($aGroupedAddressLines[$aAddressLine['type']])) $aGroupedAddressLines[$aAddressLine['type']] = array();
159                         $aGroupedAddressLines[$aAddressLine['type']][] = $aAddressLine;
160                 }
161                 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
162                 {
163                         $sGroupHeading = ucwords($sGroupHeading);
164                         echo "<h3>$sGroupHeading</h3>";
165                 foreach($aParentOfLines as $aAddressLine)
166                 {
167                         $aAddressLine['localname'] = $aAddressLine['localname']?$aAddressLine['localname']:$aAddressLine['housenumber'];
168                         $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
169         
170                         echo '<div class="line">';
171                         echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
172                         echo ' (';
173 //                      echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
174 //                      echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
175 //                      echo ', <span class="rankaddress">'.$aAddressLine['rank_address'].'</span>';
176                         echo '<span class="area">'.($aAddressLine['isarea']=='t'?'Polygon':'Point').'</span>';
177                         echo ', <span class="distance">~'.(round($aAddressLine['distance']*69,1)).'&nbsp;miles</span>';
178                         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>';
179                         echo ', <a href="details.php?place_id='.$aAddressLine['place_id'].'">GOTO</a>';
180                         echo ')';
181                         echo '</div>';
182                 }
183                 }
184                 echo '</div>';
185         }
186
187 //      echo '<h2>Other Parts:</h2>';
188 //      echo '<h2>Linked To:</h2>';
189 ?>
190
191   </body>
192 </html>