2 import { page, results_store } from '../lib/stores.js';
3 import { fetch_from_api, update_html_title } from '../lib/api_utils.js';
5 import Header from '../components/Header.svelte';
6 import SearchSectionReverse from '../components/SearchSectionReverse.svelte';
7 import ResultsList from '../components/ResultsList.svelte';
8 import Map from '../components/Map.svelte';
10 let api_request_params;
12 let position_marker; // what the user searched for
14 function loaddata(search_params) {
17 api_request_params = {
18 lat: search_params.get('lat'),
19 lon: search_params.get('lon'),
20 zoom: (search_params.get('zoom') > 1
21 ? Number(search_params.get('zoom'))
22 : Number(Nominatim_Config.Reverse_Default_Search_Zoom)),
23 layer: search_params.get('layer'),
27 if (api_request_params.lat && api_request_params.lon) {
29 fetch_from_api('reverse', api_request_params, function (data) {
30 position_marker = [api_request_params.lat, api_request_params.lon];
31 if (data && !data.error) {
32 results_store.set([data]);
34 results_store.set([]);
37 update_html_title('Reverse result for '
38 + api_request_params.lat
40 + api_request_params.lon);
41 document.querySelector('input[name=lat]').focus();
44 results_store.set(undefined);
50 if (pageinfo.tab === 'reverse') {
51 loaddata(pageinfo.params);
57 <SearchSectionReverse lat={api_request_params.lat}
58 lon={api_request_params.lon}
59 zoom={api_request_params.zoom}
60 api_request_params={api_request_params} />
65 <ResultsList bind:current_result reverse_search={true} />
67 <div id="map-wrapper">
68 <Map {current_result} {position_marker} display_minimap={true} />
85 height: calc(100vh - 250pt);
93 @media (max-width: 768px) {