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';
7 osmLink, detailsURL, wikipediaLink, coverageType, isAdminBoundary,
8 formatAddressRank, formatKeywordToken
9 } from '../lib/helpers.js';
10 import MapIcon from '../components/MapIcon.svelte';
11 import DetailsIndex from '../components/DetailsIndex.svelte';
12 import DetailsOneRow from '../components/DetailsOneRow.svelte';
13 import Map from '../components/Map.svelte';
17 let base_url = window.location.search;
20 var search_params = new URLSearchParams(window.location.search);
22 var api_request_params = {
23 place_id: search_params.get('place_id'),
24 osmtype: search_params.get('osmtype'),
25 osmid: search_params.get('osmid'),
26 class: search_params.get('class'),
27 keywords: search_params.get('keywords'),
29 hierarchy: (search_params.get('hierarchy') === '1' ? 1 : 0),
35 if (api_request_params.place_id || (api_request_params.osmtype && api_request_params.osmid)) {
37 if (api_request_params.place_id) {
38 update_html_title('Details for ' + api_request_params.place_id);
40 update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
43 fetch_from_api('details', api_request_params, function (data) {
46 current_result_store.set(undefined);
49 errorResponse = undefined;
50 current_result_store.set(data);
62 {errorResponse.error.message}
65 <div class="container">
67 <div class="col-sm-10">
70 <small><a href="{detailsURL(aPlace)}">link to this page</a></small>
73 <div class="col-sm-2 text-right">
74 <MapIcon aPlace={aPlace} />
78 <div class="col-md-6">
79 <table id="locationdetails" class="table table-striped">
84 {#each Object.keys(aPlace.names) as name}
86 <span class="name">{aPlace.names[name]}</span> ({name})
93 <td>{aPlace.category}:{aPlace.type}</td>
97 <td>{aPlace.indexed_date}</td>
99 {#if (isAdminBoundary(aPlace)) }
102 <td>{aPlace.admin_level}</td>
107 <td>{aPlace.rank_search}</td>
110 <td>Address Rank</td>
111 <td>{aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})</td>
113 {#if aPlace.calculated_importance}
117 {aPlace.calculated_importance}
118 {#if !aPlace.importance} (estimated){/if}
124 <td>{coverageType(aPlace)}</td>
127 <td>Centre Point (lat,lon)</td>
129 {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
134 <td>{@html osmLink(aPlace)}
139 (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)
141 <td>{aPlace.place_id}</td>
143 {#if aPlace.calculated_wikipedia}
145 <td>Wikipedia Calculated</td>
146 <td>{@html wikipediaLink(aPlace)}</td>
150 <td>Computed Postcode</td>
151 <td>{aPlace.calculated_postcode}</td>
154 <td>Address Tags</td>
156 {#each Object.keys(aPlace.addresstags) as name}
158 <span class="name">{aPlace.addresstags[name]}</span> ({name})
166 {#each Object.keys(aPlace.extratags) as name}
168 <span class="name">{aPlace.extratags[name]}</span> ({name})
176 <div class="col-md-6">
177 <div id="map-wrapper">
183 <div class="col-md-12">
185 <table id="address" class="table table-striped table-small">
191 <th>Address rank</th>
199 {#each aPlace.address as addressLine}
200 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
204 {#if aPlace.linked_places}
205 <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
206 {#each aPlace.linked_places as addressLine}
207 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
211 <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
212 {#if aPlace.keywords}
213 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
214 {#each aPlace.keywords.name as keyword}
216 <td>{formatKeywordToken(keyword.token)}</td>
218 <td>word id: {keyword.id}</td>
223 <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
224 {#each aPlace.keywords.address as keyword}
226 <td>{formatKeywordToken(keyword.token)}</td>
228 <td>word id: {keyword.id}</td>
235 <a class="btn btn-outline-secondary btn-sm"
236 href="{base_url}&keywords=1">display keywords</a>
241 <tr class="all-columns"><td colspan="6"><h2>Parent Of</h2></td></tr>
242 {#if aPlace.hierarchy}
244 {#each Object.keys(aPlace.hierarchy) as type}
245 <tr class="all-columns"><td colspan="6"><h3>{type}</h3></td></tr>
246 {#each aPlace.hierarchy[type] as line}
247 <DetailsOneRow addressLine={line} bDistanceInMeters=true />
251 {#if Object.keys(aPlace.hierarchy) > 500}
252 <p>There are more child objects which are not shown.</p>
257 <a class="btn btn-outline-secondary btn-sm"
258 href="{base_url}&hierarchy=1">display child places</a>
267 {:else if (window.location.search === '')}
289 background-color: white;
297 background-color: white !important;
301 border-top: none !important;
302 padding-left: 0 !important;
311 .table>thead>tr>th, .table>tbody>tr>td {
321 border: 1px solid #666;