]> git.openstreetmap.org Git - nominatim.git/commitdiff
user interface: zoom dropdown for debugging on reverse search page
authormarc tobias <mtmail@gmx.net>
Fri, 22 Jan 2016 11:54:26 +0000 (11:54 +0000)
committermarc tobias <mtmail@gmx.net>
Fri, 22 Jan 2016 11:54:26 +0000 (11:54 +0000)
lib/template/address-html.php
website/js/nominatim-ui.js

index 3a47e6acb3197521d1c5693af90f190406ed8073..1f18e96c04e5c357a11cf8edd01ee59a6158c49e 100644 (file)
   <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
     <div class="form-group">
       <input name="format" type="hidden" value="html">
-      <input name="prevmapzoom" type="hidden" value="">
       <input name="lat" type="text" class="form-control input-sm" placeholder="latitude"  value="<?php echo htmlspecialchars($_GET['lat']); ?>" >
       <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" >
+      max zoom
+
+      <select name="zoom" class="form-control input-sm" value="<?php echo htmlspecialchars($_GET['zoom']); ?>">
+        <option value="" <?php echo $_GET['zoom']==''?'selected':'' ?> >--</option>
+        <?php
+
+          $aZoomLevels = array(
+             0 => "Continent / Sea",
+             1 => "",
+             2 => "",
+             3 => "Country",
+             4 => "",
+             5 => "State",
+             6 => "Region",
+             7 => "",
+             8 => "County",
+             9 => "",
+            10 => "City",
+            11 => "",
+            12 => "Town / Village",
+            13 => "",
+            14 => "Suburb",
+            15 => "",
+            16 => "Street",
+            17 => "",
+            18 => "Building",
+            19 => "",
+            20 => "",
+            21 => "",
+          );
+
+          foreach($aZoomLevels as $iZoomLevel => $sLabel)
+          {
+            $bSel = isset($_GET['zoom']) && ($_GET['zoom'] == $iZoomLevel);
+            echo '<option value="'.$iZoomLevel.'"'.($bSel?'selected':'').'>'.$iZoomLevel.' '.$sLabel.'</option>'."\n";
+          }
+        ?>
+      </select>
     </div>
     <div class="form-group search-button-group">
       <button type="submit" class="btn btn-primary btn-sm">Search</button>
   <?php
 
     $aNominatimMapInit = [
-      'prevmapzoom' => isset($_GET['prevmapzoom'])?htmlspecialchars($_GET['prevmapzoom']):NULL,
       'zoom' => isset($_GET['zoom'])?htmlspecialchars($_GET['zoom']):NULL,
       'lat'  => isset($_GET['lat'] )?htmlspecialchars($_GET['lat']):NULL,
       'lon'  => isset($_GET['lon'] )?htmlspecialchars($_GET['lon']):NULL
index 8c82c344b2e7296c2dda6e56d59d4b5e56aecd17..1a3ae15043df2d77fa7d7a1710e75e1d91be8a53 100644 (file)
@@ -24,7 +24,7 @@ jQuery(document).on('ready', function(){
        }).addTo(map);
 
        if ( nominatim_map_init.lat ){
-               map.setView([nominatim_map_init.lat || 0, nominatim_map_init.lon], (nominatim_map_init.prevmapzoom || nominatim_map_init.zoom) );
+               map.setView([nominatim_map_init.lat || 0, nominatim_map_init.lon], nominatim_map_init.zoom);
 
                if ( is_reverse_search ){
                        // not really a market, but the .circle changes radius once you zoom in/out
@@ -48,9 +48,9 @@ jQuery(document).on('ready', function(){
                        map.getCenter().lat.toFixed(5) + ',' + map.getCenter().lng.toFixed(5) +
                        " <a target='_blank' href='" + map_link_to_osm() + "'>view on osm.org</a>";
 
-               html_viewbox = "viewbox: " + map_viewbox_as_string();
+               html_zoom = "map zoom: " + map.getZoom();
 
-               html_zoom = "zoom: " + map.getZoom();
+               html_viewbox = "viewbox: " + map_viewbox_as_string();
 
                $('#map-position').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>'));
                $('input#use_viewbox').trigger('change');
@@ -170,7 +170,6 @@ jQuery(document).on('ready', function(){
                map.on('click', function(e){
                        $('form input[name=lat]').val( e.latlng.lat);
                        $('form input[name=lon]').val( e.latlng.lng);
-                       if ( map.getZoom() > 2 ){ $('form input[name=prevmapzoom]').val( map.getZoom() ); }
                        $('form').submit();
                });
        }