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)),
26 if (api_request_params.lat || api_request_params.lat) {
28 fetch_from_api('reverse', api_request_params, function (data) {
29 if (data && !data.error) {
30 position_marker = [api_request_params.lat, api_request_params.lon];
31 results_store.set([data]);
33 results_store.set([]);
36 update_html_title('Reverse result for '
37 + api_request_params.lat
39 + api_request_params.lon);
40 document.querySelector('input[name=lat]').focus();
43 results_store.set(undefined);
49 if (pageinfo.tab === 'reverse') {
50 loaddata(pageinfo.params);
56 <SearchSectionReverse {...api_request_params} />
61 <ResultsList bind:current_result reverse_search={true} />
63 <div id="map-wrapper">
64 <Map {current_result} {position_marker} display_minimap={true} />
81 height: calc(100vh - 250pt);
89 @media (max-width: 768px) {