forked from hans/Nominatim
user interface: zoom dropdown for debugging on reverse search page
This commit is contained in:
@@ -13,9 +13,46 @@
|
|||||||
<form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
|
<form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input name="format" type="hidden" value="html">
|
<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="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']); ?>" >
|
<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>
|
||||||
<div class="form-group search-button-group">
|
<div class="form-group search-button-group">
|
||||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||||
@@ -75,7 +112,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$aNominatimMapInit = [
|
$aNominatimMapInit = [
|
||||||
'prevmapzoom' => isset($_GET['prevmapzoom'])?htmlspecialchars($_GET['prevmapzoom']):NULL,
|
|
||||||
'zoom' => isset($_GET['zoom'])?htmlspecialchars($_GET['zoom']):NULL,
|
'zoom' => isset($_GET['zoom'])?htmlspecialchars($_GET['zoom']):NULL,
|
||||||
'lat' => isset($_GET['lat'] )?htmlspecialchars($_GET['lat']):NULL,
|
'lat' => isset($_GET['lat'] )?htmlspecialchars($_GET['lat']):NULL,
|
||||||
'lon' => isset($_GET['lon'] )?htmlspecialchars($_GET['lon']):NULL
|
'lon' => isset($_GET['lon'] )?htmlspecialchars($_GET['lon']):NULL
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jQuery(document).on('ready', function(){
|
|||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
if ( nominatim_map_init.lat ){
|
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 ){
|
if ( is_reverse_search ){
|
||||||
// not really a market, but the .circle changes radius once you zoom in/out
|
// 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) +
|
map.getCenter().lat.toFixed(5) + ',' + map.getCenter().lng.toFixed(5) +
|
||||||
" <a target='_blank' href='" + map_link_to_osm() + "'>view on osm.org</a>";
|
" <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/>'));
|
$('#map-position').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>'));
|
||||||
$('input#use_viewbox').trigger('change');
|
$('input#use_viewbox').trigger('change');
|
||||||
@@ -170,7 +170,6 @@ jQuery(document).on('ready', function(){
|
|||||||
map.on('click', function(e){
|
map.on('click', function(e){
|
||||||
$('form input[name=lat]').val( e.latlng.lat);
|
$('form input[name=lat]').val( e.latlng.lat);
|
||||||
$('form input[name=lon]').val( e.latlng.lng);
|
$('form input[name=lon]').val( e.latlng.lng);
|
||||||
if ( map.getZoom() > 2 ){ $('form input[name=prevmapzoom]').val( map.getZoom() ); }
|
|
||||||
$('form').submit();
|
$('form').submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user