-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathspec-appendix.qmd
More file actions
62 lines (44 loc) · 1.82 KB
/
Copy pathspec-appendix.qmd
File metadata and controls
62 lines (44 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
title: "Appendices"
format: html
---
## Appendix A: Installation {#appendix-a-installation}
GeoCroissant support is available as an optional extra in the `mlcroissant` Python library. Installing it adds geospatial data processing capabilities and the converters needed to generate GeoCroissant metadata from existing formats.
```bash
pip install mlcroissant[geo]
```
For development installs (e.g., when working from a local clone of the repository):
```bash
pip install -e .[geo]
```
---
## Appendix B: GeoSPARQL Query Examples {#appendix-c-geosparql-query-examples}
The following SPARQL queries illustrate how GeoCroissant metadata exposed as RDF can be queried using GeoSPARQL predicates.
### Query 1: Find Datasets by Geometry (Spatial Containment)
This query retrieves all GeoCroissant datasets and records whose geometry falls within a specified bounding polygon.
```sparql
PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
PREFIX geocr: <http://mlcommons.org/croissant/geo/1.0/>
PREFIX dct: <http://purl.org/dc/terms/>
SELECT ?dataset ?record ?wkt
WHERE {
?dataset a geocr:Dataset ;
geocr:recordSet ?record .
?record geosparql:hasGeometry ?geom .
?geom geosparql:asWKT ?wkt .
FILTER(geof:sfWithin(?geom, "POLYGON((-120 30, -110 30, -110 40, -120 40, -120 30))"^^geosparql:wktLiteral))
}
```
### Query 2: Discover Datasets by Exact Bounding Box Match
This query returns all datasets whose bounding box matches a specific coordinate range.
```sparql
PREFIX geocr: <http://mlcommons.org/croissant/geo/1.0/>
PREFIX sc: <https://schema.org/>
SELECT ?dataset ?record ?bbox
WHERE {
?dataset a geocr:Dataset ;
geocr:recordSet ?record .
?record sc:spatialCoverage ?bbox .
FILTER(STR(?bbox) = "[-120.0, 30.0, -110.0, 40.0]")
}
```