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 MapIcon from '../components/MapIcon.svelte';
10 import DetailsIndex from '../components/DetailsIndex.svelte';
11 import DetailsOneRow from '../components/DetailsOneRow.svelte';
12 import DetailsLink from '../components/DetailsLink.svelte';
13 import Map from '../components/Map.svelte';
17 let base_url = window.location.search;
20 function loaddata(search_params) {
21 var api_request_params = {
22 place_id: search_params.get('place_id'),
23 osmtype: search_params.get('osmtype'),
24 osmid: search_params.get('osmid'),
25 class: search_params.get('class'),
26 keywords: search_params.get('keywords'),
28 hierarchy: (search_params.get('hierarchy') === '1' ? 1 : 0),
34 if (api_request_params.place_id || (api_request_params.osmtype && api_request_params.osmid)) {
36 if (api_request_params.place_id) {
37 update_html_title('Details for ' + api_request_params.place_id);
39 update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
42 fetch_from_api('details', api_request_params, function (data) {
43 window.scrollTo(0, 0);
46 current_result = undefined;
49 errorResponse = undefined;
50 current_result = data;
60 if (pageinfo.tab === 'details') {
61 loaddata(pageinfo.params);
67 {errorResponse.error.message}
70 <div class="container">
72 <div class="col-sm-10">
75 <small><DetailsLink feature={aPlace}>link to this page</DetailsLink></small>
78 <div class="col-sm-2 text-right">
79 <MapIcon aPlace={aPlace} />
83 <div class="col-md-6">
84 <table id="locationdetails" class="table table-striped">
89 {#each Object.keys(aPlace.names) as name}
91 <span class="name">{aPlace.names[name]}</span> ({name})
98 <td>{aPlace.category}:{aPlace.type}</td>
101 <td>Last Updated</td>
102 <td>{aPlace.indexed_date}</td>
104 {#if (isAdminBoundary(aPlace)) }
107 <td>{aPlace.admin_level}</td>
112 <td>{aPlace.rank_search}</td>
115 <td>Address Rank</td>
116 <td>{aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})</td>
118 {#if aPlace.calculated_importance}
122 {aPlace.calculated_importance}
123 {#if !aPlace.importance} (estimated){/if}
129 <td>{coverageType(aPlace)}</td>
132 <td>Centre Point (lat,lon)</td>
134 {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
139 <td>{@html osmLink(aPlace)}
144 (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)
146 <td>{aPlace.place_id}</td>
148 {#if aPlace.calculated_wikipedia}
150 <td>Wikipedia Calculated</td>
151 <td>{@html wikipediaLink(aPlace)}</td>
155 <td>Computed Postcode</td>
156 <td>{aPlace.calculated_postcode}</td>
159 <td>Address Tags</td>
161 {#each Object.keys(aPlace.addresstags) as name}
163 <span class="name">{aPlace.addresstags[name]}</span> ({name})
171 {#each Object.keys(aPlace.extratags) as name}
173 <span class="name">{aPlace.extratags[name]}</span> ({name})
181 <div class="col-md-6">
182 <div id="map-wrapper">
183 <Map {current_result} />
188 <div class="col-md-12">
190 <table id="address" class="table table-striped table-small">
196 <th>Address rank</th>
204 {#each aPlace.address as addressLine}
205 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
209 {#if aPlace.linked_places}
210 <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
211 {#each aPlace.linked_places as addressLine}
212 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
216 <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
217 {#if aPlace.keywords}
218 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
219 {#each aPlace.keywords.name as keyword}
221 <td>{formatKeywordToken(keyword.token)}</td>
223 <td>word id: {keyword.id}</td>
228 <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
229 {#each aPlace.keywords.address as keyword}
231 <td>{formatKeywordToken(keyword.token)}</td>
233 <td>word id: {keyword.id}</td>
240 <a class="btn btn-outline-secondary btn-sm"
241 href="{base_url}&keywords=1">display keywords</a>
246 <tr class="all-columns"><td colspan="6"><h2>Parent Of</h2></td></tr>
247 {#if aPlace.hierarchy}
249 {#each Object.keys(aPlace.hierarchy) as type}
250 <tr class="all-columns"><td colspan="6"><h3>{type}</h3></td></tr>
251 {#each aPlace.hierarchy[type] as line}
252 <DetailsOneRow addressLine={line} bDistanceInMeters=true />
256 {#if Object.keys(aPlace.hierarchy) > 500}
257 <p>There are more child objects which are not shown.</p>
262 <a class="btn btn-outline-secondary btn-sm"
263 href="{base_url}&hierarchy=1">display child places</a>
272 {:else if (window.location.search === '')}
286 h1 small :global(a) {
294 background-color: white;
302 background-color: white !important;
306 border-top: none !important;
307 padding-left: 0 !important;
316 .table>thead>tr>th, .table>tbody>tr>td {
326 border: 1px solid #666;