2 import { fetch_from_api, update_html_title } from '../lib/api_utils.js';
3 import { page } from '../lib/stores.js';
6 osmLink, wikipediaLink, coverageType, isAdminBoundary,
7 formatAddressRank, formatKeywordToken
8 } from '../lib/helpers.js';
9 import Header from '../components/Header.svelte';
10 import MapIcon from '../components/MapIcon.svelte';
11 import SearchSectionDetails from '../components/SearchSectionDetails.svelte';
12 import DetailsOneRow from '../components/DetailsOneRow.svelte';
13 import DetailsLink from '../components/DetailsLink.svelte';
14 import Map from '../components/Map.svelte';
18 let base_url = window.location.search;
20 let api_request_params;
22 function loaddata(search_params) {
23 api_request_params = {
24 place_id: search_params.get('place_id'),
25 osmtype: search_params.get('osmtype'),
26 osmid: search_params.get('osmid'),
27 class: search_params.get('class'),
28 keywords: search_params.get('keywords'),
30 hierarchy: (search_params.get('hierarchy') === '1' ? 1 : 0),
36 if (api_request_params.place_id || (api_request_params.osmtype && api_request_params.osmid)) {
38 if (api_request_params.place_id) {
39 update_html_title('Details for ' + api_request_params.place_id);
41 update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
44 fetch_from_api('details', api_request_params, function (data) {
45 window.scrollTo(0, 0);
48 current_result = undefined;
51 errorResponse = undefined;
52 current_result = data;
62 if (pageinfo.tab === 'details') {
63 loaddata(pageinfo.params);
69 <SearchSectionDetails api_request_params={api_request_params}/>
72 {errorResponse.error.message}
75 <div class="container">
77 <div class="col-sm-10">
80 <small><DetailsLink feature={aPlace}>link to this page</DetailsLink></small>
83 <div class="col-sm-2 text-right">
84 <MapIcon aPlace={aPlace} />
88 <div class="col-md-6">
89 <table id="locationdetails" class="table table-striped">
94 {#each Object.keys(aPlace.names) as name}
96 <span class="name">{aPlace.names[name]}</span> ({name})
103 <td>{aPlace.category}:{aPlace.type}</td>
106 <td>Last Updated</td>
107 <td>{aPlace.indexed_date}</td>
109 {#if (isAdminBoundary(aPlace)) }
112 <td>{aPlace.admin_level}</td>
117 <td>{aPlace.rank_search}</td>
120 <td>Address Rank</td>
121 <td>{aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})</td>
123 {#if aPlace.calculated_importance}
127 {aPlace.calculated_importance}
128 {#if !aPlace.importance} (estimated){/if}
134 <td>{coverageType(aPlace)}</td>
137 <td>Centre Point (lat,lon)</td>
139 {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
144 <td>{@html osmLink(aPlace)}
149 (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)
151 <td>{aPlace.place_id}</td>
153 {#if aPlace.calculated_wikipedia}
155 <td>Wikipedia Calculated</td>
156 <td>{@html wikipediaLink(aPlace)}</td>
160 <td>Computed Postcode</td>
161 <td>{aPlace.calculated_postcode}</td>
164 <td>Address Tags</td>
166 {#each Object.keys(aPlace.addresstags) as name}
168 <span class="name">{aPlace.addresstags[name]}</span> ({name})
176 {#each Object.keys(aPlace.extratags) as name}
178 <span class="name">{aPlace.extratags[name]}</span> ({name})
186 <div class="col-md-6">
187 <div id="map-wrapper">
188 <Map {current_result} />
193 <div class="col-md-12">
195 <table id="address" class="table table-striped table-small">
201 <th>Address rank</th>
209 {#each aPlace.address as addressLine}
210 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
214 {#if aPlace.linked_places}
215 <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
216 {#each aPlace.linked_places as addressLine}
217 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
221 <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
222 {#if aPlace.keywords}
223 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
224 {#each aPlace.keywords.name as keyword}
226 <td>{formatKeywordToken(keyword.token)}</td>
228 <td>word id: {keyword.id}</td>
233 <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
234 {#each aPlace.keywords.address as keyword}
236 <td>{formatKeywordToken(keyword.token)}</td>
238 <td>word id: {keyword.id}</td>
245 <a class="btn btn-outline-secondary btn-sm"
246 href="{base_url}&keywords=1">display keywords</a>
251 <tr class="all-columns"><td colspan="6"><h2>Parent Of</h2></td></tr>
252 {#if aPlace.hierarchy}
254 {#each Object.keys(aPlace.hierarchy) as type}
255 <tr class="all-columns"><td colspan="6"><h3>{type}</h3></td></tr>
256 {#each aPlace.hierarchy[type] as line}
257 <DetailsOneRow addressLine={line} bDistanceInMeters=true />
261 {#if Object.keys(aPlace.hierarchy) > 500}
262 <p>There are more child objects which are not shown.</p>
267 <a class="btn btn-outline-secondary btn-sm"
268 href="{base_url}&hierarchy=1">display child places</a>
277 {:else if (window.location.search === '')}
278 <!-- <DetailsIndex/> -->
291 h1 small :global(a) {
299 background-color: white;
307 background-color: white !important;
311 border-top: none !important;
312 padding-left: 0 !important;
321 .table>thead>tr>th, .table>tbody>tr>td {
331 border: 1px solid #666;