Skip to content

show alternate formats which are listed in links#2384

Draft
pvgenuchten wants to merge 2 commits into
geopython:masterfrom
pvgenuchten:encodings_show_provided
Draft

show alternate formats which are listed in links#2384
pvgenuchten wants to merge 2 commits into
geopython:masterfrom
pvgenuchten:encodings_show_provided

Conversation

@pvgenuchten

@pvgenuchten pvgenuchten commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Overview

  • move the links section to a generic template, reducing the code and be more uniform
  • loop through list of links, to see which alternates are available, and show those on the toolbar
  • only include json-ld link if a representation in json-ld is available (by checking links)
  • it updates the json-ld include js, to modern js

Related Issue / discussion

this came up in #2376; in coverages, there is no json-ld, still the json-ld link was shown, clicking it causes an error
on the other hand there are no links to other formats, such as jsonfg, csv, shapefile, grib2 etc
this PR solves the issue, it still needs testing against various providers/services, as it may give unexpected results

Additional information

in pygeoapi links are either advertised in response.links or response.data.links, so check both for the links element, some format such as cov-json do not have a links element, in that case the html data seems also not having the links element.

image

a mapping would be needed to translate mimetype (from link@type) to link-text, maybe the ?f=xxx format is expected, or the trans module can be used?

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@pvgenuchten pvgenuchten marked this pull request as draft June 28, 2026 17:39
@pvgenuchten pvgenuchten force-pushed the encodings_show_provided branch from 2da5e74 to 727648c Compare June 29, 2026 07:52
@webb-ben

Copy link
Copy Markdown
Member

While there are genuine limits to serving an incomplete view of the collection, might this overflow for a collection like

curl -s "https://reference.geoconnex.us/collections/hu02?f=json" \
  | jq -r '.links[] | select(.rel == "items") | .href'
https://reference.geoconnex.us/collections/hu02/items?f=json
https://reference.geoconnex.us/collections/hu02/items?f=jsonld
https://reference.geoconnex.us/collections/hu02/items?f=html
https://reference.geoconnex.us/collections/hu02/items?f=csv
https://reference.geoconnex.us/collections/hu02/items?f=csv
https://reference.geoconnex.us/collections/hu02/items?f=jsonfg
https://reference.geoconnex.us/collections/hu02/items?f=shp
https://reference.geoconnex.us/collections/hu02/items?f=gpkg
https://reference.geoconnex.us/collections/hu02/items?f=kml
https://reference.geoconnex.us/collections/hu02/items?f=parquet

@pvgenuchten

Copy link
Copy Markdown
Contributor Author

Yes, great point @webb-ben, i wondered if we can cluster similar requests and showing their formats as a list? Eg:

item detail (json, jsonld, html, csv, …)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants