2 import { onMount } from 'svelte';
3 import { fetch_from_api, update_html_title } from '../lib/api_utils.js';
4 import { current_result_store } from '../lib/stores.js';
6 import { osmLink, detailsURL, wikipediaLink, coverageType, isAdminBoundary, formatAddressRank, formatKeywordToken } from '../lib/helpers.js';
7 import MapIcon from '../components/MapIcon.svelte';
8 import DetailsIndex from '../components/DetailsIndex.svelte';
9 import DetailsOneRow from '../components/DetailsOneRow.svelte';
10 import Map from '../components/Map.svelte';
13 let base_url = window.location.search;
17 var search_params = new URLSearchParams(window.location.search);
19 var api_request_params = {
20 place_id: search_params.get('place_id'),
21 osmtype: search_params.get('osmtype'),
22 osmid: search_params.get('osmid'),
23 class: search_params.get('class'),
24 keywords: search_params.get('keywords'),
26 hierarchy: (search_params.get('hierarchy') === '1' ? 1 : 0),
32 if (api_request_params.place_id || (api_request_params.osmtype && api_request_params.osmid)) {
34 if (api_request_params.place_id) {
35 update_html_title('Details for ' + api_request_params.place_id);
37 update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
40 fetch_from_api('details', api_request_params, function(data){
42 current_result_store.set(data);
53 <div class="container">
55 <div class="col-sm-10">
58 <small><a href="{detailsURL(aPlace)}">link to this page</a></small>
61 <div class="col-sm-2 text-right">
62 <MapIcon aPlace={aPlace} />
66 <div class="col-md-6">
67 <table id="locationdetails" class="table table-striped">
72 {#each Object.keys(aPlace.names) as name}
74 <span class="name">{aPlace.names[name]}</span> ({name})
81 <td>{aPlace.category}:{aPlace.type}</td>
85 <td>{aPlace.indexed_date}</td>
87 {#if (isAdminBoundary(aPlace)) }
90 <td>{aPlace.admin_level}</td>
95 <td>{aPlace.rank_search}</td>
99 <td>{aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})</td>
101 {#if aPlace.calculated_importance}
105 {aPlace.calculated_importance}
106 {#if !aPlace.importance} (estimated){/if}
112 <td>{coverageType(aPlace)}</td>
115 <td>Centre Point (lat,lon)</td>
117 {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
122 <td>{@html osmLink(aPlace)}
127 (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)
129 <td>{aPlace.place_id}</td>
131 {#if aPlace.calculated_wikipedia}
133 <td>Wikipedia Calculated</td>
134 <td>{@html wikipediaLink(aPlace)}</td>
138 <td>Computed Postcode</td>
139 <td>{aPlace.calculated_postcode}</td>
142 <td>Address Tags</td>
144 {#each Object.keys(aPlace.addresstags) as name}
146 <span class="name">{aPlace.addresstags[name]}</span> ({name})
154 {#each Object.keys(aPlace.extratags) as name}
156 <span class="name">{aPlace.extratags[name]}</span> ({name})
164 <div class="col-md-6">
165 <div id="map-wrapper">
171 <div class="col-md-12">
173 <table id="address" class="table table-striped table-small">
179 <th>Address rank</th>
187 {#each aPlace.address as addressLine}
188 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
192 {#if aPlace.linked_places}
193 <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
194 {#each aPlace.linked_places as addressLine}
195 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
199 <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
200 {#if aPlace.keywords}
201 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
202 {#each aPlace.keywords.name as keyword}
204 <td>{formatKeywordToken(keyword.token)}</td>
206 <td>word id: {keyword.id}</td>
211 <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
212 {#each aPlace.keywords.address as keyword}
214 <td>{formatKeywordToken(keyword.token)}</td>
216 <td>word id: {keyword.id}</td>
223 <a class="btn btn-outline-secondary btn-sm"
224 href="{base_url}&keywords=1">display keywords</a>
229 <tr class="all-columns"><td colspan="6"><h2>Parent Of</h2></td></tr>
230 {#if aPlace.hierarchy}
232 {#each Object.keys(aPlace.hierarchy) as type}
233 <tr class="all-columns"><td colspan="6"><h3>{type}</h3></td></tr>
234 {#each aPlace.hierarchy[type] as line}
235 <DetailsOneRow addressLine={line} bDistanceInMeters=true />
239 {#if Object.keys(aPlace.hierarchy) > 500}
240 <p>There are more child objects which are not shown.</p>
245 <a class="btn btn-outline-secondary btn-sm"
246 href="{base_url}&hierarchy=1">display child places</a>
255 {:else if (location.search === '')}
277 background-color: white;
285 background-color: white !important;
289 border-top: none !important;
290 padding-left: 0 !important;
299 .table>thead>tr>th, .table>tbody>tr>td {
309 border: 1px solid #666;