SAWGraph Spatial KG
The SAWGraph Spatial KG is part of the Safe Agricultural Products and Water Graph (SAWGraph) project. It contains all the Level 13 grid cells from the S2 grid as well as administrative regions of levels 1 to 3 (states, counties, and county subdivisions) and the spatial relationships between them for the 48 contiguous states in the U.S.
The SAWGraph Spatial KG is a large-scale geospatial knowledge graph developed by the SAWGraph project (funded by NSF award #2333782) for researchers and practitioners working with place-based data and spatial analytics. It supports spatial reasoning, place-based linkage, and geographic data integration. The graph covers the entire 48 contiguous states in the U.S. and contains 756.9 million triples describing 16.8 million spatial entities, including 7.4 million S2 cells (Level 13 discretization) and hierarchical administrative regions across three levels: Level 1 (102 states), Level 2 (6,228 counties), Level 3 (35,458 county subdivisions such as towns and townships). The administrative entities are hierarchically linked as well as spatially integrated with the Level 13 S2 cells using the spatial:connectedTo relation. The knowledge graph leverages the KWG ontology and implements OGC GeoSPARQL standards for interoperability with other geospatial datasets.
Return the level 13 S2 cells for each county in Illinois
# Note: This query returns ~172,000 level 13 s2 cells
PREFIX kwg-ont: <http://stko-kwg.geog.ucsb.edu/lod/ontology/>
PREFIX kwgr: <http://stko-kwg.geog.ucsb.edu/lod/resource/>
PREFIX spatial: <http://purl.org/spatialai/spatial/spatial-full#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT *
WHERE {
# Find counties and their names
# Restrict them to Illinois
# Retrieve their associated S2 cells
?county rdf:type kwg-ont:AdministrativeRegion_2 ;
rdfs:label ?county_label ;
kwg-ont:administrativePartOf kwgr:administrativeRegion.USA.17 ;
spatial:connectedTo ?s2_cell .
?s2_cell rdf:type kwg-ont:S2Cell_Level13 .
# Keep only the KWG administrative regions and ignore the dcgeoid duplicates
FILTER regex(str(?county), "admin")
} ORDER BY ?county_label ?s2_cell
graph TD
Retrieve all Census Bureau county subdivisions for Clare County, Michigan.
PREFIX kwg-ont: <http://stko-kwg.geog.ucsb.edu/lod/ontology/>
PREFIX kwgr: <http://stko-kwg.geog.ucsb.edu/lod/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?cousub_label ?cousub WHERE {
# Select county subdivisions and their names
# from Clare County, MI (FIPS = 26035)
?cousub rdf:type kwg-ont:AdministrativeRegion_3 ;
kwg-ont:administrativePartOf kwgr:administrativeRegion.USA.26035 ;
rdfs:label ?cousub_label .
} ORDER BY ?cousub_label
graph TD
Returns a polygon (in WKT) that represents the boundary of Orono, Maine
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX kwg-ont: <http://stko-kwg.geog.ucsb.edu/lod/ontology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {
# Select county subdivisions, their names, and geometries
?cousub rdf:type kwg-ont:AdministrativeRegion_3 ;
rdfs:label ?cousub_label ;
geo:hasGeometry / geo:asWKT ?geom .
# Keep only the result for Orono
FILTER(?cousub_label = "Orono town, Penobscot County, Maine")
} ORDER BY ?cousub_label
graph TD
Retrieve all counties for New Mexico (FIPS = 35)
PREFIX kwgr: <http://stko-kwg.geog.ucsb.edu/lod/resource/>
PREFIX kwg-ont: <http://stko-kwg.geog.ucsb.edu/lod/ontology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT * WHERE {
?s rdf:type kwg-ont:AdministrativeRegion_2 ;
rdfs:label ?name ;
kwg-ont:administrativePartOf kwgr:administrativeRegion.USA.35 .
FILTER(regex(str(?s), "datacommons"))
} ORDER BY ?name
graph TD
| SPARQL Endpoint | https://apps.okn.us/spatialkg/sparql |
|---|---|
| Triple Pattern Fragments | https://apps.okn.us/ldf/spatialkg |
| Class | Entities |
|---|
| Property | Triples |
|---|