### WKT Literal Examples Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc Examples of WKT literals using default and explicit spatial reference systems. ```turtle "Point(-83.38 33.95)"^^ " Point(33.95 -83.38)"^^ ``` -------------------------------- ### GeoSPARQL Core: SpatialObject Example (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/09-core.adoc An example demonstrating the usage of the geo:SpatialObject class in Turtle syntax. This shows how to assign the class to an instance and provide a preferred label. ```turtle eg:x a geo:SpatialObject ; skos:prefLabel "Object X"; . ``` -------------------------------- ### GeoSPARQL GeometryCollection Example (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This example demonstrates the declaration of a geo:GeometryCollection instance, which aggregates multiple geo:Geometry instances. It uses rdfs:member to list the geometries included in the collection. ```turtle ex:gc-x a geo:GeometryCollection ; dcterms:title "Geometry Collection X" ; rdfs:member ex:geometry-shape , ex:geometry-othershape , ex:geometry-anothershape ; . ``` -------------------------------- ### Example RDF Data in Turtle Format Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This snippet defines an example application-specific spatial data model using Turtle syntax. It includes feature classes, properties for associating geometries, and specific geometry instances with Well-Known Text (WKT) representations. ```turtle @prefix geo: . @prefix my: . @prefix rdf: . @prefix rdfs: . @prefix sf: . my:PlaceOfInterest a rdfs:Class ; rdfs:subClassOf geo:Feature . my:A a my:PlaceOfInterest ; my:hasExactGeometry my:AExactGeom ; my:hasPointGeometry my:APointGeom . my:B a my:PlaceOfInterest ; my:hasExactGeometry my:BExactGeom ; my:hasPointGeometry my:BPointGeom . my:C a my:PlaceOfInterest ; my:hasExactGeometry my:CExactGeom ; my:hasPointGeometry my:CPointGeom . my:D a my:PlaceOfInterest ; my:hasExactGeometry my:DExactGeom ; my:hasPointGeometry my:DPointGeom . my:E a my:PlaceOfInterest ; my:hasExactGeometry my:EExactGeom . my:F a my:PlaceOfInterest ; my:hasExactGeometry my:FExactGeom . my:hasExactGeometry a rdf:Property ; rdfs:subPropertyOf geo:hasDefaultGeometry, geo:hasGeometry . my:hasPointGeometry a rdf:Property ; rdfs:subPropertyOf geo:hasGeometry . my:AExactGeom a sf:Polygon ; geo:asWKT """ Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"""^^geo:wktLiteral. my:APointGeom a sf:Point ; geo:asWKT """ Point(-83.4 34.3)"""^^geo:wktLiteral. my:BExactGeom a sf:Polygon ; geo:asWKT """ ``` -------------------------------- ### sfOverlaps Rule Application Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This example demonstrates how to transform a simple sfOverlaps query into a more complex one that handles different feature and geometry combinations using GeoSPARQL rules. ```APIDOC ## sfOverlaps Rule Application ### Description Finds all features or geometries that overlap with a specified feature `my:A` by applying GeoSPARQL transformation rules. ### Method SELECT ### Endpoint N/A (SPARQL Query) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```sparql PREFIX my: PREFIX geo: PREFIX geof: SELECT ?f WHERE { { ?f geo:sfOverlaps my:A } UNION { ?f geo:hasDefaultGeometry ?fGeom . ?fGeom geo:asWKT ?fSerial . my:A geo:hasDefaultGeometry ?aGeom . ?aGeom geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } UNION { ?f geo:hasDefaultGeometry ?fGeom . ?fGeom geo:asWKT ?fSerial . my:A geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } UNION { ?f geo:asWKT ?fSerial . my:A geo:hasDefaultGeometry ?aGeom . ?aGeom geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } UNION { ?f geo:asWKT ?fSerial . my:A geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } } ``` ### Response #### Success Response (200) - **?f** (string) - The feature or geometry that overlaps with `my:A`. #### Response Example ```json { "results": { "bindings": [ { "f": {"type": "uri", "value": "http://example.org/ApplicationSchema#my:D"} }, { "f": {"type": "uri", "value": "http://example.org/ApplicationSchema#my:DExactGeom"} }, { "f": {"type": "uri", "value": "http://example.org/ApplicationSchema#my:E"} }, { "f": {"type": "uri", "value": "http://example.org/ApplicationSchema#my:EExactGeom"} } ] } } ``` ``` -------------------------------- ### Example DGGS Literal Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc An example of a valid DGGS literal for the AusPIX system, demonstrating the required IRI and geometry data format. ```Turtle " CELL (R3234)"^^geo:dggsLiteral ``` -------------------------------- ### Example GML Point Geometry Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc An example of a point geometry encoded as a GML literal using the WGS 84 coordinate system. ```turtle """ -83.38 33.95 """^^ ``` -------------------------------- ### GeoSPARQL FeatureCollection Example (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This snippet shows the declaration of a geo:FeatureCollection instance, which aggregates multiple geo:Feature instances. It uses rdfs:member to list the features included in the collection. ```turtle ex:fc-x a geo:FeatureCollection ; dcterms:title "Feature Collection X" ; rdfs:member ex:feature-something , ex:feature-other , ex:feature-another ; . ``` -------------------------------- ### GeoSPARQL Feature Properties Example (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Illustrates a geo:Feature instance with various standard properties, including geometry, default geometry, length, area, volume, centroid, bounding box, and spatial resolution. It shows how these properties can be represented using QUDT units for measurements. ```turtle @prefix qudt: . eg:x a geo:Feature ; skos:preferredLabel "Feature X" ; geo:hasGeometry [ geo:asWKT " POLYGON ((-35.23610 149.06016, ... , -35.23610 149.06016))"^^geo:wktLiteral ; ] ; geo:hasDefaultGeometry [ geo:asWKT " POLYGON ((-35.2361 149.0601, ... , -35.2361 149.0601))"^^geo:wktLiteral ; ] ; geo:hasMetricLength "355"^^xsd:double ; geo:hasLength [ qudt:numericValue 355 ; qudt:unit ; # meter ] ; geo:hasMetricArea "8.7E4"^^xsd:double ; geo:hasArea [ qudt:numericValue 8.7 ; qudt:unit ; # hectare ] ; geo:hasMetricVolume "624432"^^xsd:double ; geo:hasVolume [ qudt:numericValue 624432 ; qudt:unit ; # cubic meter ] ; geo:hasCentroid [ geo:asWKT "POINT (149.06017 -35.23612)"^^geo:wktLiteral ; ] ; geo:hasBoundingBox [ geo:asWKT " POLYGON ((149.060 -35.236, ... , 149.060 -35.236))"^^geo:wktLiteral ; ] ; geo:hasMetricSpatialResolution "5"^^xsd:double ; geo:hasSpatialResolution [ qudt:numericValue 5 ; qudt:unit ; # meter ] . ``` -------------------------------- ### Apply GeoSPARQL sfOverlaps Rule Transformation Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This example demonstrates the transformation of an original GeoSPARQL query using the sfOverlaps predicate into a more detailed query that considers different feature and geometry combinations, leveraging the geof:sfOverlaps function. ```SPARQL PREFIX my: PREFIX geo: PREFIX geof: SELECT ?f WHERE { { # check for asserted statement ?f geo:sfOverlaps my:A } UNION { # feature – feature ?f geo:hasDefaultGeometry ?fGeom . ?fGeom geo:asWKT ?fSerial . my:A geo:hasDefaultGeometry ?aGeom . ?aGeom geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } UNION { # feature – geometry ?f geo:hasDefaultGeometry ?fGeom . ?fGeom geo:asWKT ?fSerial . my:A geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } UNION { # geometry – feature ?f geo:asWKT ?fSerial . my:A geo:hasDefaultGeometry ?aGeom . ?aGeom geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } UNION { # geometry – geometry ?f geo:asWKT ?fSerial . my:A geo:asWKT ?aSerial . FILTER (geof:sfOverlaps(?fSerial, ?aSerial)) } } ``` -------------------------------- ### Geometry Property Extraction Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This example demonstrates extracting minimum and maximum coordinates (minX, minY, minZ, maxX, maxY, maxZ) from a WKT geometry literal using GeoSPARQL functions. ```APIDOC ## Geometry Property Extraction ### Description Extracts bounding box coordinates from a WKT geometry literal. ### Method SELECT ### Endpoint N/A (SPARQL Query) ### Parameters #### Query Parameters N/A #### Request Body N/A ### Request Example ```sparql PREFIX geo: PREFIX geof: SELECT ?minX ?minY ?minZ ?maxX ?maxY ?maxZ WHERE { BIND(geof:minX(geof:wkt("POINT(-83.1 34.2 1)"^^geo:wktLiteral)) AS ?minX) BIND(geof:maxX(geof:wkt("POINT(-83.1 34.2 1)"^^geo:wktLiteral)) AS ?maxX) BIND(geof:minY(geof:wkt("POINT(-83.1 34.2 1)"^^geo:wktLiteral)) AS ?minY) BIND(geof:maxY(geof:wkt("POINT(-83.1 34.2 1)"^^geo:wktLiteral)) AS ?maxY) BIND(geof:minZ(geof:wkt("POINT(-83.1 34.2 1)"^^geo:wktLiteral)) AS ?minZ) BIND(geof:maxZ(geof:wkt("POINT(-83.1 34.2 1)"^^geo:wktLiteral)) AS ?maxZ) } ``` ### Response #### Success Response (200) - **?minX** (string) - The minimum X coordinate. - **?minY** (string) - The minimum Y coordinate. - **?minZ** (string) - The minimum Z coordinate. - **?maxX** (string) - The maximum X coordinate. - **?maxY** (string) - The maximum Y coordinate. - **?maxZ** (string) - The maximum Z coordinate. #### Response Example ```json { "results": { "bindings": [ { "minX": {"type": "literal", "value": "-83.4"}, "minY": {"type": "literal", "value": "34.0"}, "minZ": {"type": "literal", "value": "0"}, "maxX": {"type": "literal", "value": "-83.1"}, "maxY": {"type": "literal", "value": "34.2"}, "maxZ": {"type": "literal", "value": "1"} } ] } } ``` ``` -------------------------------- ### Declare GeoSPARQL Geometry with WKT (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This example shows how to declare a geo:Geometry instance with an absolute URI and provide its spatial data in Well-Known Text (WKT) format. If no Coordinate Reference System (CRS) is specified, WGS84 is assumed. ```turtle a geo:Geometry ; skos:prefLabel "Geometry Y"; geo:asWKT "MULTIPOLYGON (((149.06016 -35.23610, 149.060620 -35.236043, ... , 149.06016 -35.23610)))"^^geo:wktLiteral ; . ``` -------------------------------- ### Calculate Max/Min Coordinates of Geometries (SPARQL) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This query demonstrates how to find the maximum and minimum X, Y, and Z coordinates across a set of geometries. It uses the `geof:dimension`, `geof:coord`, and `geof:getCoords` functions to extract and process coordinate data. The example is set up to process a Polygon Z geometry. ```sparql PREFIX geo: PREFIX geof: SELECT ?minX ?minY ?minZ ?maxX ?maxY ?maxZ WHERE { BIND (" Polygon Z((-83.4 34.0 0, -83.1 34.0 1, ``` -------------------------------- ### GeoSPARQL Geometry with Scalar Spatial Property (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc This example demonstrates a geo:Feature with an associated geo:Geometry that includes both a WKT serialization and a scalar spatial measurement, specifically geo:hasMetricArea. This approach allows storing pre-calculated metrics alongside geometric data. ```turtle eg:x a geo:Feature ; skos:prefLabel "Feature X"; geo:hasGeometry eg:x-geo ; . eg:x-geo a geo:Geometry ; geo:asWKT "MULTIPOLYGON (((149.06016 -35.23610, 149.060620 -35.236043, ... , 149.06016 -35.23610)))"^^geo:wktLiteral ; geo:hasMetricArea "8.7E4"^^xsd:double; . ``` -------------------------------- ### Defining a Geometry Instance Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Demonstrates how to declare a Geometry instance with a preferred label and WKT serialization. ```APIDOC ## POST /geometry ### Description Declares a new geometry instance with associated spatial data. ### Method POST ### Endpoint /geometry ### Request Body - **uri** (string) - Required - The unique identifier for the geometry. - **label** (string) - Required - Preferred label for the geometry. - **wkt** (string) - Optional - Well-known Text representation of the geometry. ### Request Example { "uri": "https://example.com/geometry/y", "label": "Geometry Y", "wkt": "MULTIPOLYGON (((149.06016 -35.23610, ...)))" } ### Response #### Success Response (201) - **status** (string) - Success message. #### Response Example { "status": "Geometry created successfully" } ``` -------------------------------- ### KML Literal Example (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc An example of a KML literal representing a Point geometry. It uses the geo:kmlLiteral datatype and assumes the WGS84 coordinate system. ```Turtle " -83.38,33.95 "^^ ``` -------------------------------- ### CQL To GeoSPARQL Mappings: Basic Methods on Geometry Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Maps basic geometry methods from Simple Features for SQL to their GeoSPARQL equivalents. ```APIDOC ## Mappings: Basic Methods on Geometry ### Description Maps basic geometry methods from Simple Features for SQL to GeoSPARQL. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **Mapping Table** (Table) #### Response Example ``` | Simple Features for SQL | GeoSPARQL Equivalent | Since GeoSPARQL | Related Property Available | Since GeoSPARQL | |---|---|---|---|---| | Dimension(): Double | `geof:dimension` | - | `geo:dimension` | 1.0 | | GeometryType(): Integer | Class of geometry instance | 1.0 | N/A | - | | SRID(): Integer | `geof:getSRID` | 1.0 | N/A | - | | Envelope(): Geometry | `geof:envelope` | 1.0 | `geo:hasBoundingBox` | 1.1 | | AsText(): String | `geof:asWKT` | 1.1 | `geo:asWKT` | 1.0 | | AsBinary(): Binary | N/A | - | N/A | - | | IsEmpty(): Integer | `geof:isEmpty` | - | `geo:isEmpty` | 1.0 | | IsSimple(): Integer | `geof:isEmpty` | - | `geo:isSimple` | 1.0 | | Boundary(): Geometry | `geof:boundary` | 1.0 | N/A | - | ``` ``` -------------------------------- ### GeoJSON Literal Example (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc An example of a GeoJSON literal representing a Point geometry. It uses the geo:geoJSONLiteral datatype and assumes the WGS84 coordinate system. ```Turtle "{\"type\": \"Point\", \"coordinates\": [-83.38,33.95]}"^^ ``` -------------------------------- ### GeoJSON Geometry Literals Source: https://context7.com/opengeospatial/ogc-geosparql/llms.txt Examples of GeoJSON literals used in GeoSPARQL. GeoJSON format in GeoSPARQL always uses the WGS84 CRS84. This includes point and polygon examples. ```sparql """{"type": "Point", "coordinates": [-83.38, 33.95]}"""^^geo:geoJSONLiteral """{"type": "Polygon", "coordinates": [[[153.3610112, -27.0621757], [153.3658177, -27.1990606], [153.421436, -27.3406573], [153.3610112, -27.0621757]]]}"""^^geo:geoJSONLiteral ``` -------------------------------- ### Writing Extended WKB with GEOS Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/ewkb-community-std-work-item/community_standard/sections/06-ewkb.adoc Demonstrates how to write a geometry (linestring) into Extended WKB format using the GEOS library in C++. It covers setting SRID, output dimension, flavor, and including SRID in the output. ```cpp /* Read a linestring */ const char* linestring = "LINESTRING(0 0 1, 1 1 1, 2 1 2)"; GEOSWKBReader* reader = GEOSWKBReader_create(); GEOSGeom* geom = GEOSWKTReader_read(reader, linestring); GEOSSetSRID(geom, 4326); /* Write it out as Extended WKB */ GEOSWKBWriter* writer = GEOSWKBWriter_create(); /* Next line only needed before GEOS 3.12 */ GEOSWKBWriter_setOutputDimension(writer, 3); GEOSWKBWriter_setFlavor(writer, GEOS_WKB_EXTENDED); GEOSWKBWriter_setIncludeSRID(writer, 1); /* Generate the WKB , and store the output length */ size_t wkb_size; unsigned char* wkb = GEOSWKBWriter_write(writer, geom, &wkb_size); /* do something ... */ /* Free the WKB */ GEOSFree(wkb); GEOSGeom_destroy(geom); ``` -------------------------------- ### Get Geometry Type Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc Returns the URI representing the subtype of the geometric object. ```turtle geof:geometryType (geom: ogc:geomLiteral): xsd:anyURI ``` -------------------------------- ### Define a basic SpatialObject Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Demonstrates the instantiation of a geo:SpatialObject and assigning a label using Turtle syntax. ```turtle eg:x a geo:SpatialObject ; skos:prefLabel "Object X"; . ``` -------------------------------- ### CQL To GeoSPARQL Mappings: Surface Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Maps Surface methods from Simple Features for SQL to their GeoSPARQL equivalents. ```APIDOC ## Mappings: Surface ### Description Maps Surface methods from Simple Features for SQL to GeoSPARQL. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **Mapping Table** (Table) #### Response Example ``` | Simple Features for SQL | GeoSPARQL Equivalent | Since GeoSPARQL | Related Property Available | Since GeoSPARQL | |---|---|---|---|---| | Area(): Double | `geof:area` | - | `geo:hasArea` | 1.1 | | Centroid(): Point | `geof:centroid` | 1.1 | `geo:hasCentroid` | 1.1 | | PointOnSurface(): Point | N/A | - | N/A | - | ``` ``` -------------------------------- ### GET /conf/topology-vocab-extension/rcc8-spatial-relations Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/aa-abstract_test_suite.adoc Verifies conformance for RCC8 spatial relations in GeoSPARQL queries. ```APIDOC ## GET /conf/topology-vocab-extension/rcc8-spatial-relations ### Description Verifies that queries involving RCC8 spatial properties (e.g., geo:rcc8eq, geo:rcc8dc) return the correct results for a test dataset. ### Method GET ### Endpoint /conf/topology-vocab-extension/rcc8-spatial-relations ### Parameters #### Query Parameters - **dataset** (string) - Required - The test dataset identifier to validate against. ### Request Example GET /conf/topology-vocab-extension/rcc8-spatial-relations?dataset=test_set_01 ### Response #### Success Response (200) - **status** (string) - Conformance status (pass/fail). #### Response Example { "status": "pass" } ``` -------------------------------- ### GET /conf/topology-vocab-extension/eh-spatial-relations Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/aa-abstract_test_suite.adoc Verifies conformance for Egenhofer spatial relations in GeoSPARQL queries. ```APIDOC ## GET /conf/topology-vocab-extension/eh-spatial-relations ### Description Verifies that queries involving Egenhofer spatial properties (e.g., geo:ehEquals, geo:ehDisjoint) return the correct results for a test dataset. ### Method GET ### Endpoint /conf/topology-vocab-extension/eh-spatial-relations ### Parameters #### Query Parameters - **dataset** (string) - Required - The test dataset identifier to validate against. ### Request Example GET /conf/topology-vocab-extension/eh-spatial-relations?dataset=test_set_01 ### Response #### Success Response (200) - **status** (string) - Conformance status (pass/fail). - **details** (object) - Detailed results for each Egenhofer relation property. #### Response Example { "status": "pass", "details": { "geo:ehEquals": "success", "geo:ehDisjoint": "success" } } ``` -------------------------------- ### Get Geometry Envelope Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc Returns the minimum bounding box (rectangle) for a given geometry. ```turtle geof:envelope (geom: ogc:geomLiteral): ogc:geomLiteral ``` -------------------------------- ### Define SpatialObject with size properties Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Shows how to attach size metrics to a SpatialObject using QUDT ontology for units and specific GeoSPARQL metric properties. ```turtle @prefix qudt: . @prefix unit: . eg:moreton-island a geo:SpatialObject ; skos:prefLabel "Moreton Island" ; rdfs:seeAlso "https://en.wikipedia.org/wiki/Moreton_Island"^^xsd:anyURI ; geo:hasPerimeterLength [ qudt:numericValue "92.367"^^xsd:float ; qudt:unit unit:KiloM ; ]; geo:hasMetricPerimeterLength "92367"^^xsd:double ; . ``` -------------------------------- ### GET /sparql/features Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Retrieves spatial features from a SPARQL endpoint, optionally including geometry serializations. ```APIDOC ## GET /sparql/features ### Description Retrieves all features within a specific Feature Collection (identified by IRI) and optionally retrieves their associated geometries. ### Method GET ### Endpoint /sparql/features ### Parameters #### Query Parameters - **collection_iri** (string) - Required - The IRI of the geo:FeatureCollection to query. ### Request Example { "collection_iri": "http://example.com/x" } ### Response #### Success Response (200) - **fcollection** (IRI) - The collection identifier. - **item** (IRI) - The feature instance. - **geom** (Literal) - The serialized geometry (optional). #### Response Example { "results": [ { "item": "http://example.com/feature1", "geom": "POINT(10 20)" } ] } ``` -------------------------------- ### Define a basic Feature Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Demonstrates the instantiation of a geo:Feature and assigning a label. ```turtle eg:x a geo:Feature ; skos:prefLabel "Feature X" ; . ``` -------------------------------- ### GET /geosparql/rules/egenhofer Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/14-query_rewrite_extension.adoc Retrieves the mapping of Egenhofer relation rules to their corresponding OGC relations and functions. ```APIDOC ## GET /geosparql/rules/egenhofer ### Description Provides the transformation rules for Egenhofer relations, mapping rule identifiers to OGC relations and functions as defined in the GeoSPARQL specification. ### Method GET ### Endpoint /geosparql/rules/egenhofer ### Response #### Success Response (200) - **rules** (array) - List of mapping objects containing rule, ogc:relation, and ogc:function. #### Response Example { "rules": [ { "rule": "geor:ehEquals", "relation": "geo:ehEquals", "function": "geof:ehEquals" } ] } ``` -------------------------------- ### Implement Blog Pagination with Liquid Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/_layouts/postoverview.html This snippet iterates through paginated blog posts and displays their titles and dates. It also provides conditional navigation links for moving between pages of posts. ```liquid {% for post in paginator.posts %} * {{ post.date | date: "%b %-d, %Y" }} #### [{{ post.title }}]({{site.baseurl}}{{ post.url}}) {% endfor %} {% if paginator.total_pages > 1 %} {% if paginator.previous_page %} * [← Newer Posts]({{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}) {% endif %} {% if paginator.next_page %} * [Older Posts →]({{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}) {% endif %} {% endif %} ``` -------------------------------- ### GET /geosparql/rules/simple-features Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/14-query_rewrite_extension.adoc Retrieves the mapping of Simple Features relation rules to their corresponding OGC relations and functions. ```APIDOC ## GET /geosparql/rules/simple-features ### Description Provides the transformation rules for Simple Features relations, mapping rule identifiers to OGC relations and functions. ### Method GET ### Endpoint /geosparql/rules/simple-features ### Response #### Success Response (200) - **rules** (array) - List of mapping objects containing rule, ogc:relation, and ogc:function. #### Response Example { "rules": [ { "rule": "geor:sfEquals", "relation": "geo:sfEquals", "function": "geof:sfEquals" } ] } ``` -------------------------------- ### CQL To GeoSPARQL Mappings: LineString Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Maps LineString methods from Simple Features for SQL to their GeoSPARQL equivalents. ```APIDOC ## Mappings: LineString ### Description Maps LineString methods from Simple Features for SQL to GeoSPARQL. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **Mapping Table** (Table) #### Response Example ``` | Simple Features for SQL | GeoSPARQL Equivalent | Since GeoSPARQL | Related Property Available | Since GeoSPARQL | |---|---|---|---|---| | NumPoints(): Integer | N/A | - | N/A | - | | PointN(N: Integer): Point | N/A | - | N/A | - | ``` ``` -------------------------------- ### CQL To GeoSPARQL Mappings: MultiSurface Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Maps MultiSurface methods from Simple Features for SQL to their GeoSPARQL equivalents. ```APIDOC ## Mappings: MultiSurface ### Description Maps MultiSurface methods from Simple Features for SQL to GeoSPARQL. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **Mapping Table** (Table) #### Response Example ``` | Simple Features for SQL | GeoSPARQL Equivalent | Since GeoSPARQL | Related Property Available | Since GeoSPARQL | |---|---|---|---|---| | Area(): Double | `geof:area` | - | `geo:hasArea` | 1.1 | | Centroid(): Point | `geof:centroid` | 1.1 | `geo:hasCentroid` | 1.1 | | PointOnSurface(): Point | N/A | - | N/A | - | ``` ``` -------------------------------- ### Define Feature with historical non-convertible length unit Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Example of defining a feature length using a custom historical unit that lacks a precise conversion factor to meters. ```turtle @prefix dbp: . @prefix qudt: . ex:Seleucia_Artemita a geo:Feature ; skos:prefLabel "The route from Seleucia to Artemita"@en ; geo:hasLength [ qudt:unit ex:Schoenus ; qudt:value "15"^^xsd:integer ; ] . ex:Schoenus a qudt:Unit; skos:exactMatch dbp:Schoenus; . ``` -------------------------------- ### KML Geometry Literals Source: https://context7.com/opengeospatial/ogc-geosparql/llms.txt Examples of Keyhole Markup Language (KML) literals used in GeoSPARQL. KML format in GeoSPARQL always uses WGS84 longitude-latitude coordinates. ```sparql """ -83.38,33.95 """^^geo:kmlLiteral ``` -------------------------------- ### GML Geometry Literals Source: https://context7.com/opengeospatial/ogc-geosparql/llms.txt Examples of Geography Markup Language (GML) literals used in GeoSPARQL. GML format requires an explicit SRS (Spatial Reference System) specification. ```sparql """ -83.38 33.95 """^^geo:gmlLiteral ``` -------------------------------- ### CQL2 to GeoSPARQL Literals Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Demonstrates the conversion of various CQL2 literal types (String, Number, Boolean, Spatial Geometry, Temporal) to their corresponding GeoSPARQL or XSD literal representations. ```sparql SELECT ?item WHERE { ?item "This is a string"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "-100"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "3.14159"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "true"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "POINT(1 1)"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "{\"type\": \"Point\", \"coordinates\":[1,1]}"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "1969-07-20"^^ . } ``` ```sparql SELECT ?item WHERE { ?item "1969-07-20T20:17:40Z"^^ . } ``` -------------------------------- ### CQL To GeoSPARQL Mappings: Point Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Maps Point methods from Simple Features for SQL to their GeoSPARQL equivalents. ```APIDOC ## Mappings: Point ### Description Maps Point methods from Simple Features for SQL to GeoSPARQL. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **Mapping Table** (Table) #### Response Example ``` | Simple Features for SQL | GeoSPARQL Equivalent | Since GeoSPARQL | Related Property Available | Since GeoSPARQL | |---|---|---|---|---| | X(): Double | N/A | - | N/A | - | | Y(): Double | N/A | - | N/A | - | | Z(): Double (not in the SQL spec, but a logical extension) | N/A | - | N/A | - | | M(): Double (not in the SQL spec, but a logical extension) | N/A | - | N/A | - | ``` ``` -------------------------------- ### Get Spatial Dimension (geof:spatialDimension) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc The geof:spatialDimension function returns the spatial dimension of a geometry literal. It takes a geom:ogc:geomLiteral as input and returns an xsd:integer. ```turtle geof:spatialDimension (geom: ogc:geomLiteral): xsd:integer ``` -------------------------------- ### Using SF Geometry Classes for Feature Differentiation (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/ac-examples.adoc Demonstrates how to use specialized Simple Features Vocabulary (sf:) classes like sf:Point and sf:Polygon to differentiate geometry types within RDF. This is useful when type differentiation is needed in plain SPARQL queries rather than relying solely on literal handling. ```turtle ex:x a geo:Feature ; rdfs:label "Feature X" ; geo:hasGeometry [ a sf:Point ; geo:asWKT "POINT(...)" ; rdfs:comment "A point geometry for Feature X, possibly a centroid though not declared one" ] ; geo:hasGeometry [ a sf:Polygon ; geo:asWKT "POLYGON((...))" ; rdfs:comment "A polygon geometry for Feature X" ] . ``` -------------------------------- ### Perform Topological Spatial Queries with GeoSPARQL Source: https://context7.com/opengeospatial/ogc-geosparql/llms.txt Demonstrates various topological filter functions including sfContains, sfWithin, sfIntersects, sfTouches, sfDisjoint, sfOverlaps, and the generic relate function to perform spatial analysis on WKT geometries. ```sparql PREFIX geo: PREFIX geof: PREFIX my: # Example: sfContains SELECT ?f WHERE { my:A my:hasExactGeometry ?aGeom . ?aGeom geo:asWKT ?aWKT . ?f my:hasExactGeometry ?fGeom . ?fGeom geo:asWKT ?fWKT . FILTER (geof:sfContains(?aWKT, ?fWKT) && !sameTerm(?aGeom, ?fGeom)) } # Example: sfRelate SELECT ?feature WHERE { ?feature geo:hasGeometry/geo:asWKT ?geom . FILTER(geof:relate(?geom, ?otherGeom, "T*F**FFF*")) } ``` -------------------------------- ### Well-Known Text (WKT) Geometry Literals Source: https://context7.com/opengeospatial/ogc-geosparql/llms.txt Examples of Well-Known Text (WKT) literals used in GeoSPARQL. This includes WKT with default CRS, explicit CRS specification, polygons, and 3D geometries. ```sparql # Default CRS (WGS84 longitude-latitude) "Point(-83.38 33.95)"^^geo:wktLiteral # Explicit CRS (EPSG:4326 latitude-longitude) " Point(33.95 -83.38)"^^geo:wktLiteral # Polygon with explicit CRS " Polygon((-83.6 34.1, -83.2 34.1, -83.2 34.5, -83.6 34.5, -83.6 34.1))"^^geo:wktLiteral # 3D geometry with Z coordinates "POLYGON Z((-83.4 34.0 0, -83.1 34.0 1, -83.1 34.2 1, -83.4 34.2 1, -83.4 34.0 0))"^^geo:wktLiteral ``` -------------------------------- ### Geometry with Temporality (Turtle) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/alignments/sections/ae-alignments.adoc Illustrates assigning temporality directly to a GeoSPARQL Geometry instance using the TIME Ontology. This allows for detailed temporal descriptions of individual geometric objects. ```turtle :flooded-area-x a geo:Feature ; geo:hasGeometry [ a geo:Geometry ; geo:asWKT "POLYGON (((...)))"^^geo:wktLiteral ; time:hasTime [ ... ] ; ] ; . ``` -------------------------------- ### Get Minimum Y Coordinate (geof:minY) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc The geof:minY function returns the minimum Y coordinate for a given geometry literal. It takes a geom:ogc:geomLiteral as input and returns an xsd:double. ```turtle geof:minY (geom: ogc:geomLiteral): xsd:double ``` -------------------------------- ### Get Maximum Y Coordinate (geof:maxY) Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/11-geometry_extension.adoc The geof:maxY function returns the maximum Y coordinate for a given geometry literal. It takes a geom:ogc:geomLiteral as input and returns an xsd:double. ```turtle geof:maxY (geom: ogc:geomLiteral): xsd:double ``` -------------------------------- ### CQL To GeoSPARQL Mappings: Spatial Analysis Source: https://github.com/opengeospatial/ogc-geosparql/blob/master/spec/sections/af-cql_geosparql_mapping.adoc Maps spatial analysis methods from Simple Features for SQL to their GeoSPARQL equivalents. ```APIDOC ## Mappings: Spatial Analysis ### Description Maps spatial analysis methods from Simple Features for SQL to GeoSPARQL. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **Mapping Table** (Table) #### Response Example ``` | Simple Features for SQL | GeoSPARQL Equivalent | Since GeoSPARQL | Related Property Available | Since GeoSPARQL | |---|---|---|---|---| | Buffer(distance: Double): Geometry | `geof:buffer` | 1.0 | N/A | - | | ConvexHull(): Geometry | `geof:convexHull` | 1.0 | N/A | - | | Intersection(anotherGeometry: Geometry): Geometry | `geof:intersection` | 1.0 | N/A | - | | Union(anotherGeometry: Geometry): Geometry | `geof:union` | 1.0 | N/A | - | | Difference(anotherGeometry: Geometry): Geometry | `geof:difference` | 1.0 | N/A | - | | SymDifference(anotherGeometry: Geometry): Geometry | `geof:symDifference` | 1.0 | N/A | - | ``` ``` -------------------------------- ### GeoSPARQL Get SRID (SPARQL) Source: https://context7.com/opengeospatial/ogc-geosparql/llms.txt Retrieves the Spatial Reference System Identifier (SRID) IRI for a given geometry using the `geof:getSRID` function. This helps in understanding the CRS of the geometry data. ```SPARQL PREFIX geof: # Get SRS of each geometry SELECT ?feature (geof:getSRID(?geom) AS ?srs) WHERE { ?feature geo:hasGeometry/geo:asWKT ?geom . } ```