]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/details-html.php
Include the centre point on the details page
[nominatim.git] / lib / template / details-html.php
index f20ec619934a729e294a58aaf1aaf5222c93d5af..b56f3989a5fb30ce4df0feff3d91491b4bd2f238 100644 (file)
@@ -1,40 +1,15 @@
 <?php
        header("content-type: text/html; charset=UTF-8");
 ?>
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <title>OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?></title>
-    <style>
-body {
-       margin:0px;
-       padding:16px;
-  background:#ffffff;
-  height: 100%;
-  font: normal 12px/15px arial,sans-serif;
-}
-.line{
-  margin-left:20px;
-}
-.name{
-  font-weight: bold;
-}
-.notused{
-  color:#ddd;
-}
-.noname{
-  color:#800;
-}
-#map {
-  width:500px;
-  height:500px;
-  border: 2px solid #666;
-  float: right;
-}
-    </style>
-       <script src="js/OpenLayers.js"></script>
-       <script src="js/tiles.js"></script>
+    <link href="css/details.css" rel="stylesheet" type="text/css" />
+       <script src="js/OpenLayers.js" type="text/javascript"></script>
+       <script src="js/tiles.js" type="text/javascript"></script>
        <script type="text/javascript">
-        
+
                var map;
 
     function init() {
@@ -53,8 +28,7 @@ body {
                 projection: new OpenLayers.Projection("EPSG:900913"),
                 displayProjection: new OpenLayers.Projection("EPSG:4326")
                } );
-                       map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default",
-                        { attribution : '© <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a> and contributors, under an <a target="_parent" href="http://www.openstreetmap.org/copyright">open license</a>'}));
+                       map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default"));
 
                        var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
                        layer_style.fillOpacity = 0.2;
@@ -72,18 +46,31 @@ body {
                        });
 
                        var feature = freader.read('<?php echo $aPointDetails['outlinestring'];?>');
+                       var featureCentre = freader.read('POINT(<?php echo $aPointDetails['lon'];?> <?php echo $aPointDetails['lat'];?>)');
                        if (feature) {
                                map.zoomToExtent(feature.geometry.getBounds());
-
                                feature.style = {
                                        strokeColor: "#75ADFF",
                                        fillColor: "#F0F7FF",
                                        strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
                                        strokeOpacity: 0.75,
                                        fillOpacity: 0.75,
-                                       pointRadius: 100
+                                       pointRadius: 50
+                               };
+
+<?php if ($aPointDetails['isarea']=='t') {?>
+                               featureCentre.style = {
+                                       strokeColor: "#008800",
+                                       fillColor: "#338833",
+                                       strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
+                                       strokeOpacity: 0.75,
+                                       fillOpacity: 0.75,
+                                       pointRadius: 8
                                };
+                               vectorLayer.addFeatures([feature,featureCentre]);
+<?php } else { ?>
                                vectorLayer.addFeatures([feature]);
+<?php } ?>
                        }
                }
        </script>
@@ -105,12 +92,14 @@ body {
        }
        echo ' </div>';
        echo ' <div>Type: <span class="type">'.$aPointDetails['class'].':'.$aPointDetails['type'].'</span></div>';
+       echo ' <div>Last Updated: <span class="type">'.$aPointDetails['indexed_date'].'</span></div>';
        echo ' <div>Admin Level: <span class="adminlevel">'.$aPointDetails['admin_level'].'</span></div>';
        echo ' <div>Rank: <span class="rankaddress">'.$aPointDetails['rank_search_label'].'</span></div>';
-       if ($aPointDetails['importance']) echo ' <div>Importance: <span class="rankaddress">'.$aPointDetails['importance'].'</span></div>';
+       if ($aPointDetails['calculated_importance']) echo ' <div>Importance: <span class="rankaddress">'.$aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)').'</span></div>';
        echo ' <div>Coverage: <span class="area">'.($aPointDetails['isarea']=='t'?'Polygon':'Point').'</span></div>';
+       echo ' <div>Centre Point: <span class="area">'.$aPointDetails['lat'].','.$aPointDetails['lon'].'</span></div>';
        $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
-       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>';
+       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>';
        if ($aPointDetails['wikipedia'])
        {
                list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aPointDetails['wikipedia']);
@@ -125,7 +114,7 @@ body {
        echo '</div>';
 
        echo '<h2>Address</h2>';
-       echo '<div class=\"address\">';
+       echo '<div class="address">';
        $iPrevRank = 1000000;
        $sPrevLocalName = '';
        foreach($aAddressLines as $aAddressLine)
@@ -141,8 +130,8 @@ body {
                echo '<span class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</span>';
                echo ' (';
                echo '<span class="type"><span class="label">Type: </span>'.$aAddressLine['class'].':'.$aAddressLine['type'].'</span>';
-               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>';
-               echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
+               if ($sOSMType) echo ', <span class="osm">'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aAddressLine['osm_id'].'">'.$aAddressLine['osm_id'].'</a></span>';
+               if (isset($aAddressLine['admin_level'])) echo ', <span class="adminlevel">'.$aAddressLine['admin_level'].'</span>';
                if (isset($aAddressLine['rank_search_label'])) echo ', <span class="rankaddress">'.$aAddressLine['rank_search_label'].'</span>';
 //             echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
                echo ', <span class="distance">'.$aAddressLine['distance'].'</span>';