Skip to content

Commit

Permalink
Let js fetch raw nominatim-reverse display_name for flagged trees
Browse files Browse the repository at this point in the history
  • Loading branch information
quite committed Aug 4, 2024
1 parent f095b75 commit 7d48db0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tmpl_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,22 @@
</span>
`
}
var reverseURL = new URL('https://nominatim.openstreetmap.org/reverse')
reverseURL.searchParams.set('lat', tree.lat)
reverseURL.searchParams.set('lon', tree.lon)
reverseURL.searchParams.set('format', 'json')
const reverse = await http('GET', reverseURL.href)
if ('error' in reverse) {
html += `<p class="flagged">fel vid hämtning av nominatim-reverse för:\n\n${JSON.stringify(flagged.tree)}</p>`
continue
}
html += `
<p class="flagged">
<span class="flagtime">${flaggedAt}</span>
<span class="type">
<a href="https://fruktkartan.se/#/t/${flagged.tree}" target="_blank" rel="noopener">${tree.type}</a>
</span>
${reverse.display_name}
<br/>
<em>Flagga: </em><span class="flagname">${flagged.flag}</span>
<br/>
Expand Down

0 comments on commit 7d48db0

Please sign in to comment.