<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
}).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
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');
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();
});
}