mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-25 22:12:45 +03:00
user interface: zoom dropdown for debugging on reverse search page
This commit is contained in:
parent
690d7014f8
commit
cd37227a3c
@ -13,9 +13,46 @@
|
||||
<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>
|
||||
@ -75,7 +112,6 @@
|
||||
<?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
|
||||
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user