mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
UI: keep map position when switch to reverse. Easy switching of lat,lon to lon,lat
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input name="format" type="hidden" value="html">
|
<input name="format" type="hidden" value="html">
|
||||||
<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']); ?>" >
|
||||||
|
<span id="switch-coords"><></span>
|
||||||
<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
|
max zoom
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-type-link">
|
<div class="search-type-link">
|
||||||
<a href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
|
<a id="switch-to-reverse" href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ form label {
|
|||||||
right: 0
|
right: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#switch-coords {
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|||||||
@@ -72,6 +72,15 @@ jQuery(document).on('ready', function(){
|
|||||||
html_viewbox = "viewbox: " + map_viewbox_as_string();
|
html_viewbox = "viewbox: " + map_viewbox_as_string();
|
||||||
|
|
||||||
$('#map-position-inner').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>'));
|
$('#map-position-inner').html([html_center,html_zoom,html_viewbox,html_click,html_mouse].join('<br/>'));
|
||||||
|
|
||||||
|
var reverse_params = {
|
||||||
|
lat: map.getCenter().lat.toFixed(5),
|
||||||
|
lon: map.getCenter().lng.toFixed(5),
|
||||||
|
zoom: map.getZoom(),
|
||||||
|
format: 'html'
|
||||||
|
}
|
||||||
|
$('#switch-to-reverse').attr('href', 'reverse.php?' + $.param(reverse_params));
|
||||||
|
|
||||||
$('input#use_viewbox').trigger('change');
|
$('input#use_viewbox').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +211,14 @@ jQuery(document).on('ready', function(){
|
|||||||
$('form input[name=lon]').val( e.latlng.lng);
|
$('form input[name=lon]').val( e.latlng.lng);
|
||||||
$('form').submit();
|
$('form').submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#switch-coords').on('click', function(e){
|
||||||
|
var lat = $('form input[name=lat]').val();
|
||||||
|
var lon = $('form input[name=lon]').val();
|
||||||
|
$('form input[name=lat]').val(lon);
|
||||||
|
$('form input[name=lon]').val(lat);
|
||||||
|
$('form').submit();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
highlight_result(0, false);
|
highlight_result(0, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user