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';
16 let base_url = window.location.search;
19 var search_params = new URLSearchParams(window.location.search);
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) {
44 current_result_store.set(data);
55 <div class="container">
57 <div class="col-sm-10">
60 <small><a href="{detailsURL(aPlace)}">link to this page</a></small>
63 <div class="col-sm-2 text-right">
64 <MapIcon aPlace={aPlace} />
68 <div class="col-md-6">
69 <table id="locationdetails" class="table table-striped">
74 {#each Object.keys(aPlace.names) as name}
76 <span class="name">{aPlace.names[name]}</span> ({name})
83 <td>{aPlace.category}:{aPlace.type}</td>
87 <td>{aPlace.indexed_date}</td>
89 {#if (isAdminBoundary(aPlace)) }
92 <td>{aPlace.admin_level}</td>
97 <td>{aPlace.rank_search}</td>
100 <td>Address Rank</td>
101 <td>{aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})</td>
103 {#if aPlace.calculated_importance}
107 {aPlace.calculated_importance}
108 {#if !aPlace.importance} (estimated){/if}
114 <td>{coverageType(aPlace)}</td>
117 <td>Centre Point (lat,lon)</td>
119 {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
124 <td>{@html osmLink(aPlace)}
129 (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)
131 <td>{aPlace.place_id}</td>
133 {#if aPlace.calculated_wikipedia}
135 <td>Wikipedia Calculated</td>
136 <td>{@html wikipediaLink(aPlace)}</td>
140 <td>Computed Postcode</td>
141 <td>{aPlace.calculated_postcode}</td>
144 <td>Address Tags</td>
146 {#each Object.keys(aPlace.addresstags) as name}
148 <span class="name">{aPlace.addresstags[name]}</span> ({name})
156 {#each Object.keys(aPlace.extratags) as name}
158 <span class="name">{aPlace.extratags[name]}</span> ({name})
166 <div class="col-md-6">
167 <div id="map-wrapper">
173 <div class="col-md-12">
175 <table id="address" class="table table-striped table-small">
181 <th>Address rank</th>
189 {#each aPlace.address as addressLine}
190 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
194 {#if aPlace.linked_places}
195 <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
196 {#each aPlace.linked_places as addressLine}
197 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
201 <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
202 {#if aPlace.keywords}
203 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
204 {#each aPlace.keywords.name as keyword}
206 <td>{formatKeywordToken(keyword.token)}</td>
208 <td>word id: {keyword.id}</td>
213 <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
214 {#each aPlace.keywords.address as keyword}
216 <td>{formatKeywordToken(keyword.token)}</td>
218 <td>word id: {keyword.id}</td>
225 <a class="btn btn-outline-secondary btn-sm"
226 href="{base_url}&keywords=1">display keywords</a>
231 <tr class="all-columns"><td colspan="6"><h2>Parent Of</h2></td></tr>
232 {#if aPlace.hierarchy}
234 {#each Object.keys(aPlace.hierarchy) as type}
235 <tr class="all-columns"><td colspan="6"><h3>{type}</h3></td></tr>
236 {#each aPlace.hierarchy[type] as line}
237 <DetailsOneRow addressLine={line} bDistanceInMeters=true />
241 {#if Object.keys(aPlace.hierarchy) > 500}
242 <p>There are more child objects which are not shown.</p>
247 <a class="btn btn-outline-secondary btn-sm"
248 href="{base_url}&hierarchy=1">display child places</a>
257 {:else if (window.location.search === '')}
279 background-color: white;
287 background-color: white !important;
291 border-top: none !important;
292 padding-left: 0 !important;
301 .table>thead>tr>th, .table>tbody>tr>td {
311 border: 1px solid #666;