Skip to content

Support GeoJSON-LD templating #1927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 11, 2025
Merged

Conversation

webb-ben
Copy link
Member

@webb-ben webb-ben commented Feb 6, 2025

Overview

Building on the capacity introduced in #868 and #1858, the PR migrates GeoJSON-LD rendering to always use Jinja2 templates. The default templates provide the same functional JSON-LD output as pygeoapi currently outputs. With the addition of dataset level templating, custom JSON-LD can be rendered for an GeoJSON Feature or GeoJSON Feature Collection by implementing the appropriate template.

This allows us to also un-next the context block from a resource configuration, seeeing as the only specific configuration for linked-data is now just the context block.

Finally, serialization of geojsonld was moved inside geojson2gejsonld to reduce the number of times the json is serialized and the align with the function's docstring.

Related Issue / discussion

Additional information

In theory it is possible this type of behavior could be subsumed by a jinj2 formatter plugin - not sure how plugin formatters interact with the default HTTP types pygeoapi deals with (HTML, JSON, JSON-LD)

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

@webb-ben webb-ben added enhancement New feature or request OGC API - Features OGC API - Features linked data Linked data (schema.org/JSON-LD) labels Feb 7, 2025
@webb-ben webb-ben requested review from tomkralidis, doublebyte1 and a team and removed request for tomkralidis and doublebyte1 February 7, 2025 15:53
@totycro
Copy link
Contributor

totycro commented Feb 10, 2025

I would suggest to add at least a basic test for this to make sure that it's not broken by accident in the future.

@webb-ben
Copy link
Member Author

I would suggest to add at least a basic test for this to make sure that it's not broken by accident in the future.

Added some general tests for linked_data.py. Not sure if it is worth pulling in test_describe_collections_json_ld and test_root_structured_data

Copy link
Member

@tomkralidis tomkralidis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change requests to be applied pending #1943

@webb-ben webb-ben force-pushed the items-template branch 4 times, most recently from c73b5b6 to ccf5def Compare March 6, 2025 16:15
@webb-ben webb-ben changed the title Support JSON-LD template for items Support GeoJSON-LD templating Mar 6, 2025
@webb-ben webb-ben requested a review from tomkralidis March 6, 2025 17:02
@webb-ben
Copy link
Member Author

webb-ben commented Mar 6, 2025

@tomkralidis ported the JSON-LD templating over to use the HTML template structure. Ready for re-review.

@tomkralidis tomkralidis merged commit 9d60950 into geopython:master Mar 11, 2025
4 checks passed
webb-ben added a commit to internetofwater/reference.geoconnex.us that referenced this pull request Mar 12, 2025
jwallace94 added a commit to GeoscienceAustralia/pygeoapi that referenced this pull request Mar 23, 2025
…er (geopython#1953)"

This reverts commit 4f90235.

Revert "explicitly define init of BaseProvider (geopython#1972)"

This reverts commit ee370fb.

Revert "Fix conformance class URIs (geopython#1967)"

This reverts commit 94b0b3d.

Revert "Fix 'type' member of the rel=http://www.opengis.net/def/rel/ogc/1.0/schema link (geopython#1968)"

This reverts commit 24dc072.

Revert "Update openapi.py (geopython#1966)"

This reverts commit 00b1445.

Revert "Include JSON-LD documents in manifest (geopython#1963)"

This reverts commit b616fb0.

Revert "Support GeoJSON-LD templating (geopython#1927)"

This reverts commit 9d60950.

Revert "- gracefully catch missing tiles in wmts facade (geopython#1960)"

This reverts commit 3a9d853.

Revert "Directly render EDR JSON in HTML (geopython#1955)"

This reverts commit 7168828.

Revert "Gracefully catch tile not found (geopython#1937)"

This reverts commit f794d67.
webb-ben added a commit to internetofwater/reference.geoconnex.us that referenced this pull request Apr 4, 2025
* Remove sitemap

* Set Graph endpoint as env variable

* Update json-ld template locations

implements geopython/pygeoapi#1927

* Delete snap.png

* Create terraform deployment for required services

* Create terraform deployment for required services

* Fix templates

* Update pygeoapi.config.yml

* Update pygeoapi.config.yml

* Condense mainstem query

* Limit HTML to only show top 100 graph results

* Limit to 100k datasets on a mainstem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linked data Linked data (schema.org/JSON-LD) OGC API - Features OGC API - Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants