From b5c58be416976bcd3db1e9fb70c3bdc7894d96b3 Mon Sep 17 00:00:00 2001 From: Benjamin Webb <40066515+webb-ben@users.noreply.github.com> Date: Thu, 12 Sep 2024 23:48:52 -0400 Subject: [PATCH] Add huc containingCatchment and counties stWithin (#24) * Add huc containingCatchment * Add huc containingCatchment * Add counties j2 template * Update counties.jsonld --- .../templates/jsonld/counties.jsonld | 20 +++++++++++++ .../templates/jsonld/hu04.jsonld | 18 ++++++++++++ .../templates/jsonld/hu06.jsonld | 22 ++++++++++++++ .../templates/jsonld/hu08.jsonld | 23 +++++++++++++++ .../templates/jsonld/hu10.jsonld | 23 +++++++++++++++ pygeoapi.config.yml | 29 ++++--------------- 6 files changed, 111 insertions(+), 24 deletions(-) create mode 100644 pygeoapi-skin-dashboard/templates/jsonld/counties.jsonld create mode 100644 pygeoapi-skin-dashboard/templates/jsonld/hu04.jsonld create mode 100644 pygeoapi-skin-dashboard/templates/jsonld/hu06.jsonld create mode 100644 pygeoapi-skin-dashboard/templates/jsonld/hu08.jsonld create mode 100644 pygeoapi-skin-dashboard/templates/jsonld/hu10.jsonld diff --git a/pygeoapi-skin-dashboard/templates/jsonld/counties.jsonld b/pygeoapi-skin-dashboard/templates/jsonld/counties.jsonld new file mode 100644 index 0000000..985fe0c --- /dev/null +++ b/pygeoapi-skin-dashboard/templates/jsonld/counties.jsonld @@ -0,0 +1,20 @@ +{ + "@context": { + "schema": "https://schema.org/", + "gsp": "http://www.opengis.net/ont/geosparql#", + "name": "schema:name", + "census_profile": { + "@id": "schema:subjectOf", + "@type": "@id" + } + }, + "@id": "{{ data['@id'] }}", + "@type": "schema:Place", + "schema:name": "{{ data['name'] }}", + "census_profile": "{{ data['census_profile'] }}", + "geosparql:sfWithin": { + "@id": "https://geoconnex.us/ref/states/{{ data['statefp'] }}" + }, + "gsp:hasGeometry": {{ data['gsp:hasGeometry'] | to_json }}, + "geo": {{ data['schema:geo'] | to_json | safe }} +} diff --git a/pygeoapi-skin-dashboard/templates/jsonld/hu04.jsonld b/pygeoapi-skin-dashboard/templates/jsonld/hu04.jsonld new file mode 100644 index 0000000..332a00c --- /dev/null +++ b/pygeoapi-skin-dashboard/templates/jsonld/hu04.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "schema": "https://schema.org/", + "gsp": "http://www.opengis.net/ont/geosparql#", + "hyf": "https://www.opengis.net/def/schema/hy_features/hyf/", + "gnis_url": { + "@id": "schema:subjectOf", + "@type": "@id" + } + }, + "@id": "{{ data['@id'] }}", + "@type": "schema:Place", + "schema:name": "{{ data['name'] }}", + "gnis_url": "{{ data['gnis_url'] }}", + "hyf:containingCatchment": {"@id": "https://geoconnex.us/ref/hu02/{{ data['id'][0:2] }}"}, + "gsp:hasGeometry": {{ data['gsp:hasGeometry'] | to_json }}, + "geo": {{ data['schema:geo'] | to_json | safe }} +} diff --git a/pygeoapi-skin-dashboard/templates/jsonld/hu06.jsonld b/pygeoapi-skin-dashboard/templates/jsonld/hu06.jsonld new file mode 100644 index 0000000..1d8fea0 --- /dev/null +++ b/pygeoapi-skin-dashboard/templates/jsonld/hu06.jsonld @@ -0,0 +1,22 @@ +{ + "@context": { + "schema": "https://schema.org/", + "gsp": "http://www.opengis.net/ont/geosparql#", + "hyf": "https://www.opengis.net/def/schema/hy_features/hyf/", + "gnis_url": { + "@id": "schema:subjectOf", + "@type": "@id" + } + }, + "@id": "{{ data['@id'] }}", + "@type": "schema:Place", + "schema:name": "{{ data['name'] }}", + "gnis_url": "{{ data['gnis_url'] }}", + "hyf:containingCatchment": [ + {"@id": "https://geoconnex.us/ref/hu06/{{ data['id'][0:6] }}"}, + {"@id": "https://geoconnex.us/ref/hu04/{{ data['id'][0:4] }}"}, + {"@id": "https://geoconnex.us/ref/hu02/{{ data['id'][0:2] }}"} + ], + "gsp:hasGeometry": {{ data['gsp:hasGeometry'] | to_json }}, + "geo": {{ data['schema:geo'] | to_json | safe }} +} diff --git a/pygeoapi-skin-dashboard/templates/jsonld/hu08.jsonld b/pygeoapi-skin-dashboard/templates/jsonld/hu08.jsonld new file mode 100644 index 0000000..1d5764c --- /dev/null +++ b/pygeoapi-skin-dashboard/templates/jsonld/hu08.jsonld @@ -0,0 +1,23 @@ +{ + "@context": { + "schema": "https://schema.org/", + "gsp": "http://www.opengis.net/ont/geosparql#", + "hyf": "https://www.opengis.net/def/schema/hy_features/hyf/", + "gnis_url": { + "@id": "schema:subjectOf", + "@type": "@id" + } + }, + "@id": "{{ data['@id'] }}", + "@type": "schema:Place", + "schema:name": "{{ data['name'] }}", + "gnis_url": "{{ data['gnis_url'] }}", + "hyf:containingCatchment": [ + {"@id": "https://geoconnex.us/ref/hu08/{{ data['id'][0:8] }}"}, + {"@id": "https://geoconnex.us/ref/hu06/{{ data['id'][0:6] }}"}, + {"@id": "https://geoconnex.us/ref/hu04/{{ data['id'][0:4] }}"}, + {"@id": "https://geoconnex.us/ref/hu02/{{ data['id'][0:2] }}"} + ], + "gsp:hasGeometry": {{ data['gsp:hasGeometry'] | to_json }}, + "geo": {{ data['schema:geo'] | to_json | safe }} +} diff --git a/pygeoapi-skin-dashboard/templates/jsonld/hu10.jsonld b/pygeoapi-skin-dashboard/templates/jsonld/hu10.jsonld new file mode 100644 index 0000000..1d5764c --- /dev/null +++ b/pygeoapi-skin-dashboard/templates/jsonld/hu10.jsonld @@ -0,0 +1,23 @@ +{ + "@context": { + "schema": "https://schema.org/", + "gsp": "http://www.opengis.net/ont/geosparql#", + "hyf": "https://www.opengis.net/def/schema/hy_features/hyf/", + "gnis_url": { + "@id": "schema:subjectOf", + "@type": "@id" + } + }, + "@id": "{{ data['@id'] }}", + "@type": "schema:Place", + "schema:name": "{{ data['name'] }}", + "gnis_url": "{{ data['gnis_url'] }}", + "hyf:containingCatchment": [ + {"@id": "https://geoconnex.us/ref/hu08/{{ data['id'][0:8] }}"}, + {"@id": "https://geoconnex.us/ref/hu06/{{ data['id'][0:6] }}"}, + {"@id": "https://geoconnex.us/ref/hu04/{{ data['id'][0:4] }}"}, + {"@id": "https://geoconnex.us/ref/hu02/{{ data['id'][0:2] }}"} + ], + "gsp:hasGeometry": {{ data['gsp:hasGeometry'] | to_json }}, + "geo": {{ data['schema:geo'] | to_json | safe }} +} diff --git a/pygeoapi.config.yml b/pygeoapi.config.yml index 988fb09..657a41a 100644 --- a/pygeoapi.config.yml +++ b/pygeoapi.config.yml @@ -128,12 +128,7 @@ resources: - Hydrologic Subregions - USGS linked-data: - context: - - schema: https://schema.org/ - name: schema:name - gnis_url: - "@id": schema:subjectOf - "@type": "@id" + item_template: jsonld/hu04.jsonld links: - type: application/html rel: canonical @@ -158,12 +153,7 @@ resources: - Hydrologic Basins - USGS linked-data: - context: - - schema: https://schema.org/ - name: schema:name - gnis_url: - "@id": schema:subjectOf - "@type": "@id" + item_template: jsonld/hu06.jsonld links: - type: application/html rel: canonical @@ -188,12 +178,7 @@ resources: - Hydrologic Subbasins - USGS linked-data: - context: - - schema: https://schema.org/ - name: schema:name - gnis_url: - "@id": schema:subjectOf - "@type": "@id" + item_template: jsonld/hu08.jsonld links: - type: application/html rel: canonical @@ -218,12 +203,7 @@ resources: - Watersheds - USGS linked-data: - context: - - schema: https://schema.org/ - name: schema:name - gnis_url: - "@id": schema:subjectOf - "@type": "@id" + item_template: jsonld/hu10.jsonld links: - type: application/html rel: canonical @@ -607,6 +587,7 @@ resources: - Counties - Census linked-data: + item_template: jsonld/counties.jsonld context: - schema: https://schema.org/ name: schema:name