2 import UrlSubmitForm from '../components/UrlSubmitForm.svelte';
4 import { zoomLevels } from '../lib/helpers.js';
5 import { map_store } from '../lib/stores.js';
7 export let api_request_params = {};
9 map_store.subscribe(map => {
12 map.on('click', function (e) {
13 document.querySelector('input[name=lat]').value = e.latlng.lat.toFixed(5);
14 document.querySelector('input[name=lon]').value = e.latlng.wrap().lng.toFixed(5);
15 document.querySelector('form').submit();
19 function handleSwitchCoords() {
20 let lat = document.querySelector('input[name=lat]').value;
21 let lon = document.querySelector('input[name=lon]').value;
22 document.querySelector('input[name=lat]').value = lon;
23 document.querySelector('input[name=lon]').value = lat;
24 document.querySelector('form').submit();
30 <div class="form-group">
31 <input name="format" type="hidden" value="html">
32 <label for="reverse-lat">lat</label>
33 <input id="reverse-lat"
36 class="form-control form-control-sm"
37 placeholder="latitude"
38 value="{api_request_params.lat || ''}" />
40 on:click|preventDefault|stopPropagation={handleSwitchCoords}
41 class="btn btn-outline-secondary btn-sm"
42 title="switch lat and lon"><></a>
43 <label for="reverse-lon">lon</label>
44 <input id="reverse-lon"
47 class="form-control form-control-sm"
48 placeholder="longitude"
49 value="{api_request_params.lon || ''}" />
50 <label for="reverse-zoom">max zoom</label>
51 <select id="reverse-zoom" name="zoom" class="form-control form-control-sm" value="{api_request_params.zoom}">
52 <option value="" selected={!api_request_params.zoom}>---</option>
53 {#each zoomLevels() as zoomTitle, i}
54 <option value="{i}" selected={i === api_request_params.zoom}>{i} - {zoomTitle}</option>
57 <button type="submit" class="btn btn-primary btn-sm mx-1">
61 <div class="search-type-link">
62 <a href="details.html" class="mr-2">search by id</a>
63 <a href="search.html">forward search</a>