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';
11 import 'URLSearchParams';
14 let base_url = window.location.search;
18 var search_params = new URLSearchParams(window.location.search);
20 var api_request_params = {
21 place_id: search_params.get('place_id'),
22 osmtype: search_params.get('osmtype'),
23 osmid: search_params.get('osmid'),
24 class: search_params.get('class'),
25 keywords: search_params.get('keywords'),
27 hierarchy: (search_params.get('hierarchy') === '1' ? 1 : 0),
33 if (api_request_params.place_id || (api_request_params.osmtype && api_request_params.osmid)) {
35 if (api_request_params.place_id) {
36 update_html_title('Details for ' + api_request_params.place_id);
38 update_html_title('Details for ' + api_request_params.osmtype + api_request_params.osmid);
41 fetch_from_api('details', api_request_params, function(data){
43 current_result_store.set(data);
54 <div class="container">
56 <div class="col-sm-10">
59 <small><a href="{detailsURL(aPlace)}">link to this page</a></small>
62 <div class="col-sm-2 text-right">
63 <MapIcon aPlace={aPlace} />
67 <div class="col-md-6">
68 <table id="locationdetails" class="table table-striped">
73 {#each Object.keys(aPlace.names) as name}
75 <span class="name">{aPlace.names[name]}</span> ({name})
82 <td>{aPlace.category}:{aPlace.type}</td>
86 <td>{aPlace.indexed_date}</td>
88 {#if (isAdminBoundary(aPlace)) }
91 <td>{aPlace.admin_level}</td>
96 <td>{aPlace.rank_search}</td>
100 <td>{aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})</td>
102 {#if aPlace.calculated_importance}
106 {aPlace.calculated_importance}
107 {#if !aPlace.importance} (estimated){/if}
113 <td>{coverageType(aPlace)}</td>
116 <td>Centre Point (lat,lon)</td>
118 {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
123 <td>{@html osmLink(aPlace)}
128 (<a href="https://nominatim.org/release-docs/develop/api/Output/#place_id-is-not-a-persistent-id">on this server</a>)
130 <td>{aPlace.place_id}</td>
132 {#if aPlace.calculated_wikipedia}
134 <td>Wikipedia Calculated</td>
135 <td>{@html wikipediaLink(aPlace)}</td>
139 <td>Computed Postcode</td>
140 <td>{aPlace.calculated_postcode}</td>
143 <td>Address Tags</td>
145 {#each Object.keys(aPlace.addresstags) as name}
147 <span class="name">{aPlace.addresstags[name]}</span> ({name})
155 {#each Object.keys(aPlace.extratags) as name}
157 <span class="name">{aPlace.extratags[name]}</span> ({name})
165 <div class="col-md-6">
166 <div id="map-wrapper">
172 <div class="col-md-12">
174 <table id="address" class="table table-striped table-small">
180 <th>Address rank</th>
188 {#each aPlace.address as addressLine}
189 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=false />
193 {#if aPlace.linked_places}
194 <tr class="all-columns"><td colspan="6"><h2>Linked Places</h2></td></tr>
195 {#each aPlace.linked_places as addressLine}
196 <DetailsOneRow addressLine={addressLine} bDistanceInMeters=true />
200 <tr class="all-columns"><td colspan="6"><h2>Keywords</h2></td></tr>
201 {#if aPlace.keywords}
202 <tr class="all-columns"><td colspan="6"><h3>Name Keywords</h3></td></tr>
203 {#each aPlace.keywords.name as keyword}
205 <td>{formatKeywordToken(keyword.token)}</td>
207 <td>word id: {keyword.id}</td>
212 <tr class="all-columns"><td colspan="6"><h3>Address Keywords</h3></td></tr>
213 {#each aPlace.keywords.address as keyword}
215 <td>{formatKeywordToken(keyword.token)}</td>
217 <td>word id: {keyword.id}</td>
224 <a class="btn btn-outline-secondary btn-sm"
225 href="{base_url}&keywords=1">display keywords</a>
230 <tr class="all-columns"><td colspan="6"><h2>Parent Of</h2></td></tr>
231 {#if aPlace.hierarchy}
233 {#each Object.keys(aPlace.hierarchy) as type}
234 <tr class="all-columns"><td colspan="6"><h3>{type}</h3></td></tr>
235 {#each aPlace.hierarchy[type] as line}
236 <DetailsOneRow addressLine={line} bDistanceInMeters=true />
240 {#if Object.keys(aPlace.hierarchy) > 500}
241 <p>There are more child objects which are not shown.</p>
246 <a class="btn btn-outline-secondary btn-sm"
247 href="{base_url}&hierarchy=1">display child places</a>
256 {:else if (location.search === '')}
278 background-color: white;
286 background-color: white !important;
290 border-top: none !important;
291 padding-left: 0 !important;
300 .table>thead>tr>th, .table>tbody>tr>td {
310 border: 1px solid #666;