2 let { postcode, lat, lon } = $props();
4 const overpass_query = $derived(`
5 // Based on the map bounds, you can zoom out and rerun the query
7 [timeout:30]; // in seconds
9 // we define a shortcut
10 // https://wiki.openstreetmap.org/wiki/Overpass_turbo/Extended_Overpass_Turbo_Queries
11 {{postcode=${postcode}}}
14 node["addr:postcode"="{{postcode}}"]({{bbox}});
15 way["addr:postcode"="{{postcode}}"]({{bbox}});
16 relation["addr:postcode"="{{postcode}}"]({{bbox}});
18 node["postal_code"="{{postcode}}"]({{bbox}});
19 way["postal_code"="{{postcode}}"]({{bbox}});
20 relation["postal_code"="{{postcode}}"]({{bbox}});
26 `.replace(/^ {4}/gm, ''));
28 // https://wiki.openstreetmap.org/wiki/Overpass_turbo/Development#URL_Parameters
32 const url = $derived('https://overpass-turbo.eu/'
33 + '?Q=' + encodeURIComponent(overpass_query)
34 + '&C=' + encodeURIComponent([lat, lon, 15].join(';'))
37 function openHint(ev) {
40 document.getElementById('postcode-hint').style.display = 'block';
42 function closeHint(ev) {
44 document.getElementById('postcode-hint').style.display = 'none';
48 (<a href="#openHint" onclick={openHint}>how?</a>)
50 <div id="postcode-hint" class="my-2 p-2">
52 class="btn-close float-end m-1"
57 Nightly calculated from nearby places having this postcode.
58 <a href="https://nominatim.org/release-docs/latest/admin/Maintenance/#updating-postcodes">
63 You can search for those with an
64 <a href={url} target="_blank" rel="noreferrer">Overpass Turbo query</a>.
67 <a href="https://nominatim.org/2022/06/26/state-of-postcodes.html"
68 target="_blank" rel="noreferrer">How Nominatim uses postcodes</a>.
75 background-color: var(--bs-secondary-bg);