whosonfirst / go-whosonfirst-spelunker-httpd

Go package implementing an HTTP server for interacting with implementations of the whosonfirst/go-whosonfirst-spelunker.Spelunker interface.
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

"This is a {PLACETYPE} in {CONTEXT}" strings for list views #21

Open straup opened 2 months ago

straup commented 2 months ago

For example:

https://spelunker.whosonfirst.org/search?q=alberta

Should render items with the following contextual information:

And so on.

straup commented 2 months ago

Notes to self:

This needs to be a template function that takes {{ .Feature }} as its input and:

  1. Loops through wof:hierarchy list for that feature creating a single unified list of common ancestors
  2. Builds an ordered array of placetype -> wof_id pointers from that list for {{ .Feature }} – use code in go-whosonfirst-placetypes
  3. Optionally filters that list in code (rather than the template)
  4. Writes the list to the template in the form of <span class="wof-namify" data-id="{ID}">{ID}</span> and leaves resolving the name of each place to the wof-namify.js code

For an example of a place with multiple hierarchies:

https://spelunker.whosonfirst.org/id/102527513

Steps 1-3 should probably be bundled in go-whosonfirst-placetypes once all the kinks have been worked out.