]> git.openstreetmap.org Git - nominatim.git/commitdiff
responsive details-error page. Shared header and footer
authorMarc Tobias Metten <mtmail@gmx.net>
Tue, 19 Jan 2016 11:29:07 +0000 (12:29 +0100)
committerMarc Tobias Metten <mtmail@gmx.net>
Tue, 19 Jan 2016 11:29:07 +0000 (12:29 +0100)
12 files changed:
VAGRANT.md
lib/template/details-error-html.php
lib/template/details-html.php
lib/template/includes/html-footer.php
lib/template/includes/html-top-navigation.php [new file with mode: 0644]
lib/template/search-html.php
website/css/common.css [new file with mode: 0644]
website/css/details.css
website/css/search.css
website/details.php
website/js/nominatim-ui.js
website/search.php

index 504d28f3cd24676ce5a1e849f0c52221faf86dc4..3a8e479bde7283329dfc4c02064d1a4bead35ed8 100644 (file)
@@ -129,7 +129,7 @@ No. Long running Nominatim installations will differ once new import features (o
 bug fixes) get added since those usually only get applied to new/changed data.
 
 Also this document skips the optional Wikipedia data import which affects ranking
-of search results. See [Nominatim instllation](http://wiki.openstreetmap.org/wiki/Nominatim/Installation) for details.
+of search results. See [Nominatim installation](http://wiki.openstreetmap.org/wiki/Nominatim/Installation) for details.
 
 ##### Why Ubuntu, can I test CentOS/CoreOS/FreeBSD?
 
index 1268414d8f6de04d2dd2987a59cd0bc08f94b7da..1c6d2a0a4db705f89bcf856d6ced3453f0019f05 100644 (file)
 <?php
        header("content-type: text/html; charset=UTF-8");
 ?>
-<!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>
-       <script type="text/javascript">
-        
-               var map;
-
-    function init() {
-                       map = new OpenLayers.Map ("map", {
-                controls:[
-                                                                               new OpenLayers.Control.Permalink(),
-                                                                               new OpenLayers.Control.Navigation(),
-                                                                               new OpenLayers.Control.PanZoomBar(),
-                                                                               new OpenLayers.Control.MouseDefaults(),
-                                                                               new OpenLayers.Control.MousePosition(),
-                                                                               new OpenLayers.Control.Attribution()],
-                maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
-                maxResolution: 156543.0399,
-                numZoomLevels: 19,
-                units: 'm',
-                projection: new OpenLayers.Projection("EPSG:900913"),
-                displayProjection: new OpenLayers.Projection("EPSG:4326")
-               } );
-                       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;
-                        layer_style.graphicOpacity = 0.2;
-
-                       vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
-                       map.addLayer(vectorLayer);
-
-            var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
-                       var proj_map = map.getProjectionObject();
-
-            freader = new OpenLayers.Format.WKT({
-                'internalProjection': proj_map,
-                'externalProjection': proj_EPSG4326
-            });
-
-            var bounds;
-            <?php if ($aPointDetails['prevgeom']) { ?>
-            var feature = freader.read('<?php echo $aPointDetails['prevgeom'];?>');
-            if (feature) {
-                bounds = feature.geometry.getBounds();
-
-            }
-            feature.style = {
-                               strokeColor: "#777777",
-                               fillColor: "#F0F0F0",
-                               strokeWidth: 2,
-                               strokeOpacity: 0.75,
-                               fillOpacity: 0.75,
-                strokeDashstyle: "longdash"
-                       };
-            vectorLayer.addFeatures([feature]);
-            <?php } ?>
-
-            <?php if ($aPointDetails['newgeom']) { ?>
-            feature = freader.read('<?php echo $aPointDetails['newgeom'];?>');
-            if (feature) {
-                if (!bounds) {
-                    bounds = feature.geometry.getBounds();
-                } 
-                else 
-                {
-                    bounds.extend(feature.geometry.getBounds());
-                }
-            }
-            feature.style = {
-                               strokeColor: "#75ADFF",
-                               fillColor: "#FFF7F0",
-                               strokeWidth: 2,
-                               strokeOpacity: 0.75,
-                               fillOpacity: 0.75
-                       };
-            vectorLayer.addFeatures([feature]);
-            <?php } ?>
-
-            <?php if (isset($aPointDetails['error_x'])) { ?>
-            var pt = new OpenLayers.Geometry.Point(<?php echo $aPointDetails['error_x'].','.$aPointDetails['error_y'];?>);
-            pt = pt.transform(proj_EPSG4326, proj_map);
-            feature = new OpenLayers.Feature.Vector(pt, null,
-                       {
-                            graphicName : "x",
-                            fillColor: "#FF0000",
-                            graphic : true,
-                            pointRadius: 6
-                       });
-            vectorLayer.addFeatures([feature]);
-            <?php } ?>
-
-
-            map.zoomToExtent(bounds);
+<?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
+       <link href="css/common.css" rel="stylesheet" type="text/css" />
+       <link href="css/details.css" rel="stylesheet" type="text/css" />
+</head>
+
 
-               }
-               
-       </script>
-  </head>
-  <body onload="init();">
-    <div id="map"></div>
-       <h1><?php echo $aPointDetails['localname'] ?></h1>
-       <div class="locationdetails">
-       <div>Type: <span class="type"><?php echo $aPointDetails['class'].':'.$aPointDetails['type'];?></span></div>
 <?php
-    $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>';
-?>
 
-    <p>This object has an invalid geometry.</p>
-    <p><b>Details:</b> <?php
-
-$sVal = $aPointDetails['errormessage']?$aPointDetails['errormessage']:'&nbsp;';
-$sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
-$sOSMID = $aPointDetails['osm_id'];
-
-if (isset($aPointDetails['error_x']))
-{
-       $sLat = $aPointDetails['error_y'];
-       $sLon = $aPointDetails['error_x'];
-       echo "<a href=\"http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$sOSMID."\">".$sVal."</a>";
-}
-else
-{
-       echo $sVal;
-}
+       function osm_link($aFeature)
+       {
+               $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
+               if ($sOSMType) {
+                       return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
+               }
+               return '';
+       }
+
+       function osm_map_url($aFeature)
+       {
+               $sLon = $aFeature['error_x'];
+               $sLat = $aFeature['error_y'];
+
+               if (isset($sLat))
+               {
+                       $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
+                       if ($sOSMType)
+                       {
+                               return "http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$aFeature['osm_id'];
+                       }
+               }
+               return '';
+       }
+
+       function josm_edit_url($aFeature)
+       {
+               $fWidth = 0.0002;
+               $sLon = $aFeature['error_x'];
+               $sLat = $aFeature['error_y'];
+
+               if (isset($sLat))
+               {
+                       return "http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth);
+               }
+
+               $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
+               if ($sOSMType)
+               {
+                       return 'http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aFeature['osm_id'].'/full';
+                       // Should be better to load by object id - but this doesn't seem to zoom correctly
+                       // return " <a href=\"http://localhost:8111/load_object?new_layer=true&objects=".strtolower($aFeature['osm_type']).$sOSMID."\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
+               }
+               return '';
+       }
+
+       function potlach_edit_url($aFeature)
+       {
+               $fWidth = 0.0002;
+               $sLat = $aFeature['error_y'];
+               $sLon = $aFeature['error_x'];
+
+               if (isset($sLat))
+               {
+                       return "http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth);
+               }
+               return '';
+       }
+
+
+
 ?>
-    <p><b>Edit:</b> in <?php
-if (isset($aPointDetails['error_x']))
-{
-       $fWidth = 0.0002;
-       echo " <a href=\"http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth)."\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
-       echo " | <a href=\"http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth)."\" target=\"potlatch2\">Potlatch 2</a>";
-}
-else
-{
-       echo " <a href=\"http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/".$sOSMType.'/'.$sOSMID."/full\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
-       // Should be better to load by object id - but this doesn't seem to zoom correctly
-       //echo " <a href=\"http://localhost:8111/load_object?new_layer=true&objects=".strtolower($aPointDetails['osm_type']).$sOSMID."\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
-}
-
-?></p>
-
-  </body>
-</html>
 
+<body id="details-page">
+       <div class="container">
+               <div class="row">
+                       <div class="col-md-6">
+
+
+                               <h1><?php echo $aPointDetails['localname'] ?></h1>
+                               <div class="locationdetails">
+                                       <h2 class="bg-danger">This object has an invalid geometry.</h2>
+
+                                       <div>
+                                               Type: <span class="type"><?php echo $aPointDetails['class'].':'.$aPointDetails['type'];?></span>
+                                       </div>
+
+                                       <div>
+                                               OSM: <span class="label"><?php echo osm_link($aPointDetails); ?><span>
+                                       </div>
+
+
+                                       <h4>Error</h4>
+                                       <p>
+                                               <?php echo $aPointDetails['errormessage']?$aPointDetails['errormessage']:'unknown'; ?>
+                                       </p>
+                                       <?php if (osm_map_url($aPointDetails)) { ?>
+                                               <a href="<?php echo osm_map_url($aPointDetails); ?>">view on osm.org</a>
+                                       <?php } ?>
+
+                                       <h4>Edit</h4>
+                                       <ul>
+                                       <?php if (josm_edit_url($aPointDetails)) { ?>
+                                                       <li><a href="<?php echo josm_edit_url($aPointDetails); ?>" target="josm">Remote Control (JOSM / Merkaartor)</a></li>
+                                       <?php } ?>
+                                       <?php if (potlach_edit_url($aPointDetails)) { ?>
+                                                       <li><a href="<?php echo potlach_edit_url($aPointDetails); ?>" target="potlatch2">Potlatch 2</a></li>
+                                       <?php } ?>
+                                       </ul>
+                       </div>
+               </div>
+               <div class="col-md-6">
+                       <div id="map"></div>
+               </div>
+
+       </div>
+
+
+       <script type="text/javascript">
+
+               var nominatim_result = {
+                       outlinestring: '<?php echo $aPointDetails['outlinestring'];?>',
+                       lon: <?php echo isset($aPointDetails['error_x']) ? $aPointDetails['error_x'] : 0; ?>,
+                       lat: <?php echo isset($aPointDetails['error_y']) ? $aPointDetails['error_y'] : 0; ?>
+               };
+
+       </script>
+
+
+       <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
+       </body>
+</html>
\ No newline at end of file
index da36167cb793f05d0b503a6a03e5e246ad72e643..548cee7a6bf03def144ffed669f1cc388ea4babf 100644 (file)
@@ -2,9 +2,11 @@
        header("content-type: text/html; charset=UTF-8");
 ?>
 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
+       <link href="css/common.css" rel="stylesheet" type="text/css" />
        <link href="css/details.css" rel="stylesheet" type="text/css" />
 </head>
 
+<?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
 
 
 <?php
@@ -17,7 +19,8 @@
        function osm_link($aFeature)
        {
                $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
-               if ($sOSMType) {
+               if ($sOSMType)
+               {
                        return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
                }
                return '';
@@ -28,7 +31,7 @@
                if ($aFeature['wikipedia'])
                {
                        list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
-                       return '<a href="http://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'">'.$aFeature['wikipedia'].'</a>';
+                       return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
                }
                return '';
        }
 
        function format_distance($fDistance)
        {
-               return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,1)).' km</abbr>';
+               // $fDistance is in meters
+               if ($fDistance < 1)
+               {
+                       return '0';
+               }
+               elseif ($fDistance < 1000)
+               {
+                       return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
+               }
+               else
+               {
+                       return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
+               }
        }
 
        function kv($sKey,$sValue)
                </div>
        </div>
 
-       <footer>
-               <p class="copyright">
-                       &copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
-               </p>
-       </footer>
-
-
        <script type="text/javascript">
 
                var nominatim_result = {
 
 
        <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
-  </body>
+</body>
 </html>
index 78d0984763ead55da1b2a2c2ae57ba28978b5bc9..3083c11bb8be4022d89b4121cddb718bbfb87b01 100644 (file)
@@ -1,6 +1,14 @@
-       <script src="js/jquery.min.js"></script>
-       <script src="js/bootstrap.min.js"></script>
-       <script src="js/leaflet.min.js"></script>
-       <script src="js/leaflet-omnivore.min.js"></script>
-       <script src="js/nominatim-ui.js"></script>
-       
\ No newline at end of file
+<footer>
+  <p class="disclaimer">
+    Addresses and postcodes are approximate
+  </p>
+  <p class="copyright">
+    &copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
+  </p>
+</footer>
+
+<script src="js/jquery.min.js"></script>
+<script src="js/bootstrap.min.js"></script>
+<script src="js/leaflet.min.js"></script>
+<script src="js/leaflet-omnivore.min.js"></script>
+<script src="js/nominatim-ui.js"></script>
diff --git a/lib/template/includes/html-top-navigation.php b/lib/template/includes/html-top-navigation.php
new file mode 100644 (file)
index 0000000..92eb0fb
--- /dev/null
@@ -0,0 +1,49 @@
+  <header class="container-fluid">
+    <div class="row">
+      <div class="col-xs-4">
+        <div class="brand">
+          <a href="<?php echo CONST_Website_BaseURL;?>">
+          <img alt="logo" src="images/osm_logo.120px.png" width="40" height="40"/>
+          <h1>Nominatim</h1>
+          </a>
+        </div>
+      </div>
+      <div id="last-updated" class="col-xs-4 text-center">
+        <?php if ($sDataDate){ ?>
+          Data last updated:
+          <br>
+          <?php echo $sDataDate; ?>
+        <?php } ?>
+      </div>
+      <div class="col-xs-4 text-right">
+        <div class="btn-group">
+          <button class="dropdown-toggle btn btn-default" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
+            About &amp; Help <span class="caret"></span>
+          </button>
+          <ul class="dropdown-menu dropdown-menu-right">
+            <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li>
+            <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li>
+            <li role="separator" class="divider"></li>
+            <li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </header>
+
+  <div class="modal fade" id="report-modal">
+    <div class="modal-dialog">
+      <div class="modal-content">
+        <div class="modal-header">
+          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+          <h4 class="modal-title">Report a problem</h4>
+        </div>
+        <div class="modal-body">
+          <?php include(CONST_BasePath.'/lib/template/includes/report-errors.php'); ?>
+        </div>
+        <div class="modal-footer">
+          <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
+        </div>
+      </div>
+    </div>
+  </div>
index 91e9e89090a64909223da2df1dbe5844022ad244..a327b4939fb69d7ca446d9d4a02d8f2d37f7f424 100644 (file)
@@ -2,42 +2,13 @@
        header("content-type: text/html; charset=UTF-8");
 ?>
 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
+       <link href="css/common.css" rel="stylesheet" type="text/css" />
        <link href="css/search.css" rel="stylesheet" type="text/css" />
 </head>
 
 <body id="search-page">
 
-
-       <header class="container-fluid">
-               <div class="row">
-                       <div class="col-xs-4">
-                               <div class="brand">
-                                       <a href="<?php echo CONST_Website_BaseURL;?>">
-                                       <img alt="logo" src="images/osm_logo.120px.png" width="40" height="40"/>
-                                       <h1>Nominatim</h1>
-                                       </a>
-                               </div>
-                       </div>
-                       <div id="last-updated" class="col-xs-4 text-center">
-                               Data last updated:
-                               <br>
-                               <?php echo $sDataDate; ?>
-                       </div>
-                       <div class="col-xs-4 text-right">
-                               <div class="btn-group">
-                                       <button class="dropdown-toggle btn btn-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
-                                               About &amp; Help <span class="caret"></span>
-                                       </button>
-                                       <ul class="dropdown-menu dropdown-menu-right">
-                                               <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li>
-                                               <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li>
-                                               <li role="separator" class="divider"></li>
-                                               <li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li>
-                                       </ul>
-                               </div>
-                       </div>
-               </div>
-       </header>
+       <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
 
        <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php">
                <div class="form-group">
 
        </div> <!-- /content -->
 
-       <footer>
-               <p class="disclaimer">
-                       Addresses and postcodes are approximate
-               </p>
-               <p class="copyright">
-                       &copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
-               </p>
-       </footer>
-
-       <div class="modal fade" id="report-modal">
-               <div class="modal-dialog">
-                       <div class="modal-content">
-                               <div class="modal-header">
-                                       <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
-                                       <h4 class="modal-title">Report a problem</h4>
-                               </div>
-                               <div class="modal-body">
-                                       <?php include(CONST_BasePath.'/lib/template/includes/report-errors.php'); ?>
-                               </div>
-                               <div class="modal-footer">
-                                       <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
-                               </div>
-                       </div>
-               </div>
-       </div>
+
+
 
 
 
diff --git a/website/css/common.css b/website/css/common.css
new file mode 100644 (file)
index 0000000..8a36339
--- /dev/null
@@ -0,0 +1,31 @@
+header {
+  width: 100%;
+  padding: 15px;
+  z-index: 5;
+}
+
+header .brand {
+  white-space: nowrap;
+}
+
+header .brand a:hover{
+  text-decoration: none;
+}
+
+header .brand h1 {
+  display: inline;
+  font-size: 1.5em;
+  color: #333;
+}
+
+header .brand > img {
+  display: inline-block;
+  margin-right: 5px;
+  margin-top: -5px;
+}
+
+header #last-updated {
+  font-size: 0.7em;
+  white-space: nowrap;
+  text-align: center;
+}
index 8fb1f915799dbfdcfa854b5a534e8bdbc6fffea7..f0ab036211fa0e8f0544137c5881b6795d739a08 100644 (file)
@@ -1,7 +1,3 @@
-body {
-  margin-top: 1em;
-  font-size: 1.2em;
-}
 h1 {
   margin: 30px 0;
 }
@@ -13,8 +9,7 @@ h3 {
   font-size: 1.5em;
 }
 .table {
-  /*width: auto;*/
-  max-width: 800px;
+  width: 100%;
 }
 .name{
   font-weight: bold;
index 89ccc8ef5a9deb78728b6aa0a6011b6de5b12aa0..8ac51f9a94448f307400ccb08073c8876ccf8db9 100644 (file)
@@ -1,34 +1,3 @@
-header {
-  width: 100%;
-  padding: 15px;
-  z-index: 5;
-}
-
-header .brand {
-  white-space: nowrap;
-}
-
-header .brand a:hover{
-  text-decoration: none;
-}
-
-header .brand h1 {
-  display: inline;
-  font-size: 1.5em;
-  color: #333;
-}
-
-header .brand > img {
-  display: inline-block;
-  margin-right: 5px;
-  margin-top: -5px;
-}
-
-header #last-updated {
-  font-size: 0.7em;
-  white-space: nowrap;
-  text-align: center;
-}
 
 
 form {
@@ -47,7 +16,7 @@ form label {
 
 .sidebar {
   width: 25%;
-  padding: 10px;
+  padding: 15px;
   padding-top: 0;
   display: inline-block;
   float: left;
index ceba8581851e6d01c4b5ae1236241d58e0120536..54d8015ead9de33023a3016164780746a2ff872d 100755 (executable)
@@ -25,6 +25,7 @@
                $_GET['place_id'] = $oDB->getOne("select place_id from placex where osm_type = '".$_GET['osmtype']."' and osm_id = ".(int)$_GET['osmid']." order by type = 'postcode' asc");
 
                // Be nice about our error messages for broken geometry
+
                if (!$_GET['place_id'])
                {
                        $aPointDetails = $oDB->getRow("select osm_type, osm_id, errormessage, class, type, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ST_AsText(prevgeometry) as prevgeom, ST_AsText(newgeometry) as newgeom from import_polygon_error where osm_type = '".$_GET['osmtype']."' and osm_id = ".(int)$_GET['osmid']." order by updated desc limit 1");
                                        $aPointDetails['error_x'] = $aMatches[1];
                                        $aPointDetails['error_y'] = $aMatches[2];
                                }
+                               else
+                               {
+                                       $aPointDetails['error_x'] = 0;
+                                       $aPointDetails['error_y'] = 0;
+                               }
                                include(CONST_BasePath.'/lib/template/details-error-'.$sOutputFormat.'.php');
                                exit;
                        }
                }
        }
 
+
        if (!isset($_GET['place_id']))
        {
                echo "Please select a place id";
@@ -90,7 +97,7 @@
        $aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], true);
 
        // Linked places
-       $sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_distance(geometry, placegeometry) as distance, ";
+       $sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
        $sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
        $sSQL .= " from placex, (select geometry as placegeometry from placex where place_id = $iPlaceID) as x";
        $sSQL .= " where linked_place_id = $iPlaceID";
        $aLinkedLines = $oDB->getAll($sSQL);
 
        // All places this is an imediate parent of
-       $sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_distance(geometry, placegeometry) as distance, ";
+       $sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
        $sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
        $sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
        $sSQL .= " where parent_place_id = $iPlaceID order by rank_address asc,rank_search asc limit 500) as obj,";
index bb4fa37786fbb85fe33911e4cc6e9671c96ffac0..b99def9a7eedbae47701445c6957e2c92110431d 100644 (file)
@@ -165,14 +165,18 @@ jQuery(document).on('ready', function(){
 
                var layerGroup = new L.layerGroup().addTo(map);
 
-
-               var outline = omnivore.wkt.parse(nominatim_result.outlinestring);
-               map.addLayer(outline);
-
                var circle = L.circleMarker([nominatim_result.lat,nominatim_result.lon], { radius: 10, weight: 2, fillColor: '#ff7800', color: 'blue', opacity: 0.75});
                map.addLayer(circle);
 
-               map.fitBounds(outline.getBounds());
+               if ( nominatim_result.outlinestring ){
+                       var outline = omnivore.wkt.parse(nominatim_result.outlinestring);
+                       map.addLayer(outline);
+                       map.fitBounds(outline.getBounds());
+               } else {
+                       map.setView([nominatim_result.lat,nominatim_result.lon],10);
+               }
+
+
 
 });
 
index 6b58443cd1e670a8d6c295bc1aa3698463fe151a..9137beade1921d8ab619b19f80f04d24978476b7 100755 (executable)
                $bAsSVG = (boolean)isset($_GET['polygon_svg']) && $_GET['polygon_svg'];
                $bAsText = (boolean)isset($_GET['polygon_text']) && $_GET['polygon_text'];
                if ( ( ($bAsGeoJSON?1:0)
-                    + ($bAsKML?1:0)
-                    + ($bAsSVG?1:0)
-                    + ($bAsText?1:0)
-                    + ($bAsPoints?1:0)
-                    ) > CONST_PolygonOutput_MaximumTypes)
+                                + ($bAsKML?1:0)
+                                + ($bAsSVG?1:0)
+                                + ($bAsText?1:0)
+                                + ($bAsPoints?1:0)
+                                ) > CONST_PolygonOutput_MaximumTypes)
                {
                        if (CONST_PolygonOutput_MaximumTypes)
                        {
                }
                include(CONST_BasePath.'/lib/template/search-batch-json.php');
                exit;
-       } else {
-        if (!(isset($_GET['q']) && $_GET['q']) && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
-        {
-            $sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
-
-            // reverse order of '/' separated string
-            $aPhrases = explode('/', $sQuery);
-            $aPhrases = array_reverse($aPhrases);
-            $sQuery = join(', ',$aPhrases);
-            $oGeocode->setQuery($sQuery);
-        }
-        else
-        {
-            $oGeocode->setQueryFromParams($_GET);
-        }
-
-    }
+       }
+       else
+       {
+               if (!(isset($_GET['q']) && $_GET['q']) && isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'][0] == '/')
+               {
+                               $sQuery = substr(rawurldecode($_SERVER['PATH_INFO']), 1);
+
+                               // reverse order of '/' separated string
+                               $aPhrases = explode('/', $sQuery);
+                               $aPhrases = array_reverse($aPhrases);
+                               $sQuery = join(', ',$aPhrases);
+                               $oGeocode->setQuery($sQuery);
+               }
+               else
+               {
+                               $oGeocode->setQueryFromParams($_GET);
+               }
+       }
 
        $hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);