/geoconnex:geoconnex-queryingfrom geoconnex
Guides querying Geoconnex hydrologic data via its reference feature server, SPARQL graph endpoint, OGC API, and STAC catalog.
Ships in geoconnex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Geoconnex refers to both a graph database and the overall infrastructure that provides it with data or presents it in other formats. There are multiple ways to retrieve data from within Geoconnex. Each has a different tradeoff.
The reference feature server is located at https://reference.geoconnex.us/ and is an OGC API server running pygeoapi. It serves reference hydrologic boundary data for the US like HUCs, States, and Mainstems. It does not include data from external federal agencies (those are submitted as separate contributions to Geoconnex and hosted separately). It is an efficient and interoperables way to quickly load data from a specific reference boundary for GIS workflows. It is populated from gpkg/geojson data on hydroshare here: https://www.hydroshare.org/resource/3295a17b4cc24d34bd6a5c5aaf753c50/
A list of all collections in the reference feature server OGC API can be found at: https://reference.geoconnex.us/collections/
To get the JSON-LD that populates the Geoconnex graph, you can look up a specific feature and then add f=jsonld to the end, that is what the Geoconnex crawler will harvest. https://reference.geoconnex.us/collections/states/items/20?f=jsonld
The Geoconnex graph located at graph.geoconnex.us is the SPARQL endpoint to an RDF graph database. The graph is generally structured according the SHACL shape described in the docs here: https://docs.geoconnex.us/reference/data-formats/shacl_shape However, some user submitted datasets are outdated or structured incorrectly leading to isolated data in the graph.
The list of datasets that populate Geoconnex can be found in the sitemap here: https://geoconnex.us/sitemap.xml
The Geoconnex graph is populated by either crawling persistent identifiers directly, or ingesting an entire dataset at once by using a Geoconnex bulk integration as described here: https://docs.geoconnex.us/contributing/bulk/ Bulk datasets may be slow to run but if you need to reproduce a specific dataset's RDF from within the graph, they can be ran directly.
If you want to download a bulk nquad dump of the graph for local use you can use the OCI artifact export hosted on ghcr like this: oras pull ghcr.io/internetofwater/geoconnex-graph:latest
Geoconnex SPARQL queries link together a hydrologic feature with its associated geospatial or dataset relationships. The identifier used for the hydrologic feature is the @id in the harvested JSON-LD. The Geoconnex graph contains over 500 million triples with over 3.5 million geospatial features. As such, efficient production queries should use limits, filters, or other ways to prevent very large payloads.
#All datasets about the Animas River mainstem
PREFIX schema: <https://schema.org/>
PREFIX gsp: <http://www.opengis.net/ont/geosparql#>
PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>
SELECT DISTINCT ?monitoringLocation ?siteName ?datasetDescription ?type ?url
?variableMeasured ?variableUnit ?measurementTechnique ?temporalCoverage
?distributionName ?distributionURL ?distributionFormat ?wkt
WHERE {
VALUES ?mainstem { <https://geoconnex.us/ref/mainstems/35394> }
?monitoringLocation hyf:referencedPosition/hyf:HY_IndirectPosition/hyf:linearElement ?mainstem ;
schema:subjectOf ?item ;
hyf:HydroLocationType ?type ;
gsp:hasGeometry/gsp:asWKT ?wkt .
?item schema:name ?siteName ;
schema:temporalCoverage ?temporalCoverage ;
schema:url ?url ;
schema:variableMeasured ?variableMeasured .
?variableMeasured schema:description ?datasetDescription ;
schema:name ?variableMeasuredName ;
schema:unitText ?variableUnit ;
schema:measurementTechnique ?measurementTechnique .
OPTIONAL {
?item schema:distribution ?distribution .
?distribution schema:name ?distributionName ;
schema:contentUrl ?distributionURL ;
schema:encodingFormat ?distributionFormat .
}
# Filter datasets by the desired variable description
FILTER(REGEX(?datasetDescription, "temperature", "i"))
}
ORDER BY ?siteName
#Map all monitoring locations on the Snake River
PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>
PREFIX gsp: <http://www.opengis.net/ont/geosparql#>
SELECT DISTINCT ?monitoringLocation ?wkt
WHERE {
# Specify your desired mainstem
VALUES ?mainstem { <https://geoconnex.us/ref/mainstems/35394> }
# Get monitoring locations along the mainstem
?monitoringLocation hyf:referencedPosition/hyf:HY_IndirectPosition/hyf:linearElement ?mainstem ;
gsp:hasGeometry/gsp:asWKT ?wkt .
}
https://features.geoconnex.us/collections/GeoconnexFeatures is an OGC API endpoint for all the geospatial features in Geoconnex, not just the reference boundaries contained within https://reference.geoconnex.us/ It may be referred to as the Geoconnex OGC API Features endpoint but this is not a canonical name. It uses pygeoapi with the postgres provider. It is the only collection in this OGC API endpoint. The goal of this endpoint is to discover features, not datasets or linked relationships. The feature IDs can then be used as an input to SPARQL queries if needed. The following properties may be present on a features:
id geoconnex_sitemap feature_name feature_description mainstem_uri
The main benefit of this endpoint is that it supports the OGC CQL2 standard. This allows for sophisticated property or text filters that may have poor performance at scale in the https://graph.geoconnex.us endpoint.
https://features.geoconnex.us/collections/GeoconnexFeatures/items?bbox=-72.8,40.8,-68.8,47.7&mainstem_uri=https%3A%2F%2Fgeoconnex.us%2Fref%2Fmainstems%2F2290857&limit=100https://features.geoconnex.us/collections/GeoconnexFeatures/items?filter=feature_name%20ILIKE%20%27reservoir%25%27&limit=1000Geoconnex provides a STAC catalog of all the geospatial data contained in the graph here. This catalog contains both GeoParquet and PMTiles exports for each dataset. Each feature in Geoconnex is a separate row; some properties like feature_name are extracted from the row for more performant querying. The source jsonld RDF data can be found within the jsonld column for each feature. The GeoParquet files in this catalog are the source files which populate https://features.geoconnex.us/collections/GeoconnexFeatures as well as the graph.
Note that this is primarily focused on exposing geospatial data and some basic metadata like the name and description of the feature. For other linked metadata such as dataset info that doesn't have direct geospatial data on it, you should make queries against the full graph database.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
geoconnex-querying, sparql, ogc-api, hydrologic-data, geospatial
npx claudepluginhub internetofwater/geoconnex.us --plugin geoconnex2 skills in this plugin
Other plugins' skills for the same job