2         header("content-type: text/html; charset=UTF-8");
 
   6         <title>OpenStreetMap Nominatim: Search</title>
 
   8         <base href="<?php echo CONST_Website_BaseURL;?>" />
 
   9         <link href="nominatim.xml" rel="search" title="Nominatim Search" type="application/opensearchdescription+xml" />
 
  11         <script src="js/OpenLayers.js"></script>
 
  12         <script src="js/tiles.js"></script>
 
  13         <script src="js/prototype-1.6.0.3.js"></script>
 
  16 * {-moz-box-sizing: border-box;}
 
  23   font: normal 12px/15px arial,sans-serif;
 
  33   border-bottom: 2px solid #75ADFF;
 
  38 #seachheaderfade1, #seachheaderfade2, #seachheaderfade3, #seachheaderfade4{
 
  45   filter: alpha(opacity = 15);
 
  47   border: 1px solid #000000;
 
  61 #searchresultsfade1, #searchresultsfade2, #searchresultsfade3, #searchresultsfade4 {
 
  68   filter: alpha(opacity = 20);
 
  70   border: 1px solid #ffffff;
 
  92   border: 1px solid #ffffff;
 
 112   font: normal 12px/15px arial,sans-serif;
 
 132   -moz-border-radius: 5px;
 
 133   -webkit-border-radius: 5px;
 
 135   border: 2px solid #D7E7FF;
 
 136   font: normal 12px/15px arial,sans-serif;
 
 151   font: normal 9px/10px arial,sans-serif;
 
 154 .result .details, .result .details a{
 
 157   font: normal 9px/10px arial,sans-serif;
 
 163   font: normal 12px arial,sans-serif;
 
 174   font: normal 9px/10px arial,sans-serif;
 
 183         <script type="text/javascript">
 
 187                 function handleResize()
 
 189                         if ($('searchresults'))
 
 191                                 $('map').style.width = (document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 200;
 
 192                                 $('report').style.width = (document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 200;
 
 196                                 $('map').style.width = (document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 0;
 
 197                                 $('map').style.left = 0;
 
 200                         if ($('map')) $('map').style.height = (document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38;
 
 201                         if ($('searchresults')) $('searchresults').style.height = (document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38;
 
 202                         if ($('report')) $('report').style.height = (document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38;
 
 204                 window.onresize = handleResize;
 
 206                 function panToLatLon(lat,lon) {
 
 207                         var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
 
 208                         map.panTo(lonLat, <?php echo $iZoom ?>);
 
 211                 function panToLatLonZoom(lat, lon, zoom) {
 
 212                         var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
 
 213                         if (zoom != map.getZoom())
 
 214                                 map.setCenter(lonLat, zoom);
 
 216                                 map.panTo(lonLat, 10);
 
 219                 function panToLatLonBoundingBox(lat,lon,minlat,maxlat,minlon,maxlon,wkt) {
 
 220                         vectorLayer.destroyFeatures();
 
 221                         var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
 
 222                         var proj_map = map.getProjectionObject();
 
 223                         map.zoomToExtent(new OpenLayers.Bounds(minlon,minlat,maxlon,maxlat).transform(proj_EPSG4326, proj_map));
 
 224                         var lonLat = new OpenLayers.LonLat(lon, lat).transform(proj_EPSG4326, proj_map);
 
 225                         map.panTo(lonLat, <?php echo $iZoom ?>);
 
 229                                 var freader = new OpenLayers.Format.WKT({
 
 230                                                 'internalProjection': proj_map,
 
 231                                                 'externalProjection': proj_EPSG4326
 
 234                                 var feature = freader.read(wkt);
 
 238                                                         strokeColor: "#75ADFF",
 
 239                                                         fillColor: "#F0F7FF",
 
 245                                         vectorLayer.addFeatures([feature]);
 
 253                         return Math.round(v*n)/n;
 
 258                         return Math.floor(v*n)/n;
 
 263                         return Math.ceil(v*n)/n;
 
 266                 function mapEventMove() {
 
 267                         var proj = new OpenLayers.Projection("EPSG:4326");
 
 268                         var bounds = map.getExtent();
 
 269                         bounds = bounds.transform(map.getProjectionObject(), proj);
 
 270                         $('viewbox').value = floor(bounds.left,2)+','+ceil(bounds.top,2)+','+ceil(bounds.right,2)+','+floor(bounds.bottom,2);
 
 275                         map = new OpenLayers.Map ("map", {
 
 277                                                                                 new OpenLayers.Control.Navigation(),
 
 278                                                                                 new OpenLayers.Control.PanZoomBar(),
 
 279                                                                                 new OpenLayers.Control.MouseDefaults(),
 
 280                                                                                 new OpenLayers.Control.MousePosition(),
 
 281                                                                                 new OpenLayers.Control.Attribution()],
 
 282                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
 
 283                 maxResolution: 156543.0399,
 
 286                 projection: new OpenLayers.Projection("EPSG:900913"),
 
 287                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
 
 289                                                                         "moveend": mapEventMove
 
 292                         map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default",
 
 293                          { 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>'}));
 
 295                         var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
 
 296                         layer_style.fillOpacity = 0.2;
 
 297                         layer_style.graphicOpacity = 1;
 
 298                         vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
 
 299                         map.addLayer(vectorLayer);
 
 301 //                      var lonLat = new OpenLayers.LonLat(<?php echo $fLon ?>, <?php echo $fLat ?>).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
 
 302 //                      map.setCenter (lonLat, <?php echo $iZoom ?>);
 
 305                 function setfocus(field_id) { 
 
 312 <body onload="setfocus('q');">
 
 314         <div id="seachheaderfade1"></div><div id="seachheaderfade2"></div><div id="seachheaderfade3"></div><div id="seachheaderfade4"></div>
 
 316         <div id="seachheader">
 
 317                 <form accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php" method="get">
 
 318                         <table border="0" width="100%">
 
 320                                         <td valign="center" style="width:30px;"><img src="images/logo.gif"></td>
 
 321                                         <td valign="center" style="width:400px;"><input id="q" name="q" value="<?php echo htmlspecialchars($sQuery); 
 
 322 ?>" style="width:270px;"><input type="text" id="viewbox" style="width:130px;" name="viewbox"></td>
 
 323                                         <td style="width:80px;"><input type="submit" value="Search"></td>
 
 324 <?php if (CONST_Search_AreaPolygons) { ?>                                       <td style="width:100px;"><input type="checkbox" value="1" name="polygon" <?php if ($bAsText) echo "checked"; ?>> Highlight</td>
 
 325 <td style="text-align:right;">Data: <?php echo $sDataDate; ?></td>
 
 326 <td style="text-align:right;">
 
 327 <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a> | <a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" 
 
 328 target="_blank">FAQ</a></td>
 
 330 <?php } ?>                                      <td style="text-align:right;"><?php if ($sQuery) { ?><input type="button" value="Report Problem With Results" onclick="$('report').style.visibility=($('report').style.visibility=='hidden'?'visible':'hidden')"><?php } ?></td>
 
 337         if ($sQuery || sizeof($aSearchResults))
 
 340         <div id="searchresultsfade1"></div><div id="searchresultsfade2"></div><div id="searchresultsfade3"></div><div id="searchresultsfade4"></div>
 
 341         <div id="searchresults">
 
 345                 echo '<div class="more"><b>Suggest: </b><a href="'.$sSuggestionURL.'"><b>'.$sSuggestion.'</b></a></div>';
 
 347         foreach($aSearchResults as $iResNum => $aResult)
 
 349                 if ($aResult['aBoundingBox'])
 
 351                         echo '<div class="result" onClick=\'panToLatLonBoundingBox('.$aResult['lat'].', '.$aResult['lon'];
 
 352                         echo ', '.$aResult['aBoundingBox'][0];
 
 353                         echo ', '.$aResult['aBoundingBox'][1];
 
 354                         echo ', '.$aResult['aBoundingBox'][2];
 
 355                         echo ', '.$aResult['aBoundingBox'][3];
 
 356                         if (isset($aResult['astext'])) echo ', "'.$aResult['astext'].'"';
 
 359                 elseif (isset($aResult['zoom']))
 
 361                         echo '<div class="result" onClick="panToLatLonZoom('.$aResult['lat'].', '.$aResult['lon'].', '.$aResult['zoom'].');">';
 
 365                         echo '<div class="result" onClick="panToLatLon('.$aResult['lat'].', '.$aResult['lon'].');">';
 
 368                 echo (isset($aResult['icon'])?'<img src="'.$aResult['icon'].'">':'');
 
 369                 echo ' <span class="name">'.$aResult['name'].'</span>';
 
 370                 echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
 
 371                 echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
 
 372                 if (isset($aResult['label']))
 
 373                         echo ' <span class="type">('.$aResult['label'].')</span>';
 
 375                         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
 
 376                 echo ' <span class="details">(<a href="details.php?place_id='.$aResult['place_id'].'">details</a>)</span>';
 
 379         if (sizeof($aSearchResults))
 
 383                         echo '<div class="more"><a href="'.$sMoreURL.'">Search for more results</a></div>';
 
 388                 echo '<div class="noresults">No search results found</div>';
 
 392                 <div class="disclaimer">Addresses and postcodes are approximate
 
 393                         <input type="button" value="Report Problem" onclick="$('report').style.visibility=($('report').style.visibility=='hidden'?'visible':'hidden')">
 
 401         <div id="report" style="visibility:hidden;"><div style="width:600px;margin:auto;margin-top:60px;">
 
 402                 <h2>Report a problem</h2>
 
 403                 <p>Before reporting problems please read the <a href="http://wiki.openstreetmap.org/wiki/Nominatim">user documentation</a> and <a 
 
 404 href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ">FAQ</a>.  If your problem relates to the address of a particular search result please use the 'details' link 
 
 405 to check how the address was generated before reporting a problem.</p>
 
 406                 <p>Please use <a href="http://trac.openstreetmap.org/newticket?component=nominatim">trac.openstreetmap.org</a> to report problems 
 
 408 the component to 'nominatim'.  You can search for existing bug reports <a href="http://trac.openstreetmap.org/query?status=new&status=assigned&status=reopened&component=nominatim&order=priority">here</a>.</p>
 
 409                 <p>Please ensure that you include a full description of the problem, including the search query that you used, the problem with the result and, if 
 
 410 the problem relates to missing data, the osm id of the item that is missing.  Problems that contain enough detail are likely to get looked at before ones that 
 
 411 require significant research!</p>
 
 415                 <p>Please use this form to report problems with the search results.  Of particular interest are items missing, but please also use this form to 
 
 416 report any other problems.</p>
 
 417                 <p>If your problem relates to the address of a particular search result please use the 'details' link to check how the address was generated before 
 
 418 reporting a problem.</p>
 
 419                 <p>If you are reporting a missing result please (if possible) include the OSM ID of the item you where expecting (i.e. node 422162)</p>
 
 422                 <tr><th>Your Query:</th><td><input type="hidden" name="report:query" value="<?php echo htmlspecialchars($sQuery); ?>" style="width:500px;"><?php echo htmlspecialchars($sQuery); ?></td></tr>
 
 423                 <tr><th>Your Email Address(opt):</th><td><input type="text" name="report:email" value="" style="width:500px;"></td></tr>
 
 424                 <tr><th>Description of Problem:</th><td><textarea name="report:description" style="width:500px;height:200px;"></textarea></td></tr>
 
 425                 <tr><td colspan="2" class="button"><input type="button" value="Cancel" onclick="$('report').style.visibility='hidden'"><input type="submit" value="Report"></td></tr>
 
 428                 <h2>Known Problems</h2>
 
 430                 <li>Countries where missed out of the index</li>
 
 431                 <li>Area Polygons relate to the search area - not the address area which would make more sense</li>
 
 436         <script type="text/javascript">
 
 439         foreach($aSearchResults as $iResNum => $aResult)
 
 441                 if ($aResult['aBoundingBox'])
 
 443                         echo 'panToLatLonBoundingBox('.$aResult['lat'].', '.$aResult['lon'];
 
 444                         echo ', '.$aResult['aBoundingBox'][0];
 
 445                         echo ', '.$aResult['aBoundingBox'][1];
 
 446                         echo ', '.$aResult['aBoundingBox'][2];
 
 447                         echo ', '.$aResult['aBoundingBox'][3];
 
 448                         if (isset($aResult['astext'])) echo ", '".$aResult['astext']."'";
 
 453                         echo 'panToLatLonZoom('.$fLat.', '.$fLon.', '.$iZoom.');'."\n";
 
 457         if (!sizeof($aSearchResults))
 
 459                 echo 'panToLatLonZoom('.$fLat.', '.$fLon.', '.$iZoom.');'."\n";