Skip to content

Commit 98e8b53

Browse files
committed
Merge branch 'main' of github.com:LandscapeGeoinformatics/pydggsapi
2 parents 6ce36b6 + bd4325e commit 98e8b53

1 file changed

Lines changed: 25 additions & 212 deletions

File tree

README.md

Lines changed: 25 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -6,252 +6,65 @@ A python FastAPI OGC DGGS API implementation
66

77
https://pydggsapi.readthedocs.io/en/latest/
88

9+
10+
911
## OGC API - Discrete Global Grid Systems
1012

1113
https://ogcapi.ogc.org/dggs/
1214

1315
OGC API - DGGS specifies an API for accessing data organised according to a Discrete Global Grid Reference System (DGGRS). A DGGRS is a spatial reference system combining a discrete global grid hierarchy (DGGH, a hierarchical tessellation of zones to partition) with a zone indexing reference system (ZIRS) to address the globe. Aditionally, to enable DGGS-optimized data encodings, a DGGRS defines a deterministic for sub-zones whose geometry is at least partially contained within a parent zone of a lower refinement level. A Discrete Global Grid System (DGGS) is an integrated system implementing one or more DGGRS together with functionality for quantization, zonal query, and interoperability. DGGS are characterized by the properties of the zone structure of their DGGHs, geo-encoding, quantization strategy and associated mathematical functions.
1416

1517
![](bids25_fig1.png)
16-
## Setup and Dependencies
17-
18-
1. setup virtual environment with micromamba file and active it.
19-
20-
```
21-
micromamba create -n <name> -f micromamba_env.yaml
22-
mircomamba activate <name>
23-
```
24-
25-
In order to use DGGRID, the dggrid executable needs to be available. You can compile it yourself, or install into the conda/micromamba environment from conda-forge:
26-
27-
```
28-
micromamba install -c conda-forge dggrid
29-
```
3018

31-
2. run poetry to install dependencies
32-
33-
```
34-
poetry install
35-
```
19+
## Setup
20+
Please refer to the [Quick Setup](https://pydggsapi.readthedocs.io/en/latest/introduction.html#quick-setup) section from the documentation for details.
3621

37-
3. create local .env file from env.sample
22+
## Configration and implementation details
3823

39-
```
40-
DGGS_API_CONFIG=<Path to TinyDB>
41-
DGGRID_PATH=<Path to dggrid executable>
42-
```
43-
44-
4. Start the server for development:
45-
46-
```
47-
export POETRY_DOTENV_LOCATION=.env && poetry run python pydggsapi/main.py
48-
```
24+
Please refer to the [Configuration](https://pydggsapi.readthedocs.io/en/latest/tinydb_configuration/index.html) section from the documentation for details.
4925

26+
## Example notebook
27+
Please refer to the [Example](https://pydggsapi.readthedocs.io/en/latest/example_notebook/pydggsapi_demo_notebook.html#) section from the documentation for demonstration.
5028

5129
## Conformance Classes
5230

53-
The API implemented the dggrs-core, zone-query and zone data retrieval conformal class. The following list shows the conformance classes supported by the API. Users can also refer to the [example notebook](https://pydggsapi.readthedocs.io/en/latest/example_notebook/Endpoints_Examples.html) from the pydggsapi documentation for examples of the query endpoints.
31+
The API implemented the dggrs-core, zone-query and zone data retrieval, conformal class. The following list shows the conformance classes supported by the API. Users can also refer to the [example notebook](https://pydggsapi.readthedocs.io/en/latest/example_notebook/Endpoints_Examples.html) from the pydggsapi documentation for examples of the query endpoints.
5432

5533
| Conformance Class| Supported by the API|
5634
| ---------------- | ------------------- |
35+
| **Core** | |
5736
| http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core ||
58-
| http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/landing-page ||
59-
| http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/html ||
60-
| http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/json ||
61-
| http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/collections ||
37+
| **OGC API integration**| |
38+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/root-dggs ||
39+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/collection-dggs ||
40+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/operation-ids ||
41+
| **For Data Retrieval**| |
6242
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-retrieval ||
6343
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-subsetting | partially: `datetime`, `properties` and `exclude-properties`|
6444
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-custom-depths ||
6545
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-cql2-filter ||
66-
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-query ||
46+
| **For Zone Queries**| |
47+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-query | ✅ , query parameter `subset` and `subset-crs` is not supported yet|
6748
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-query-cql2-filter ||
68-
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/root-dggs ||
69-
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/collection-dggs ||
49+
| **Zone Data Encodings**| |
7050
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-json ||
7151
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-ubjson ||
7252
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-dggs-jsonfg ||
7353
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-dggs-ubjsonfg ||
7454
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-geojson ||
55+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-geotiff ||
56+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-netcdf ||
57+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-coveragejson ||
7558
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-zarr ||
59+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-jpegxl ||
60+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/data-png ||
61+
| **Zone List Encodings**| |
62+
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-html ||
7663
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-uint64 ||
7764
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-geojson ||
7865
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/zone-geotiff ||
79-
| https://www.opengis.net/spec/ogcapi-dggs-1/1.0/conf/operation-ids ||
80-
81-
82-
## Mini Howto
83-
84-
### Collections, Collection Providers and DGGRS providers
85-
86-
The are two parts of configurations.
87-
88-
User Configurations:
89-
90-
- Collections : to define a collection with meta data, how to access the data (collection provider) and which dggrs it support (dggrs provider).
91-
92-
System configurations:
93-
94-
- Collection Providers : Implementation to access the data.
95-
- DGGRS providers : Implementation to support API endpoint operations for DGGS
96-
97-
Each data collection must be already formatted in one of the supported DGGRS implementation (ie. at least one columns to represent the zone ID)
98-
99-
#### An example for Collections definition (in TinyDB):
100-
101-
The below example shows how a collection is defined :
102-
103-
1. The collections ID (suitability_hytruck), it is the key of the collection.
104-
105-
2. meta data (title, description)
106-
107-
3. collection provider :
108-
109-
- providerId : the collection provider id that defined in [collection_providers section](#collection_provider_id)
110-
- dggrsId : the dggrs ID that defined in [dggrs section](#dggrs_provider_id). It indicate the dggrs that comes with the data.
111-
- maxzonelevel : the maximum refinement level that is support by the data with the dggrs defined above.
112-
- getdata_params : it is collections provider specific, It use to provide details parameters for the get_data function implemented by collection providers.
113-
114-
```
115-
"collections": {"1":
116-
{"suitability_hytruck":
117-
{"title": "Suitability Modelling for Hytruck",
118-
"description": "Desc",
119-
"collection_provider": {
120-
"providerId": "clickhouse",
121-
"dggrsId": "igeo7",
122-
"maxzonelevel": 9,
123-
"getdata_params":
124-
{ "table": "testing_suitability_IGEO7",
125-
"zoneId_cols": {"9":"res_9_id", "8":"res_8_id", "7":"res_7_id", "6":"res_6_id", "5":"res_5_id"},
126-
"data_cols" ["modelled_fuel_stations","modelled_seashore","modelled_solar_wind",
127-
"modelled_urban_nodes", "modelled_water_bodies", "modelled_gas_pipelines",
128-
"modelled_hydrogen_pipelines", "modelled_corridor_points", "modelled_powerlines",
129-
"modelled_transport_nodes", "modelled_residential_areas", "modelled_rest_areas",
130-
"modelled_slope"]
131-
}
132-
}
133-
}
134-
}
135-
}
136-
```
137-
138-
#### An example for Collection Providers definition (in TinyDB):
139-
140-
The below example shows how a collection provider is defined :
141-
142-
<a name="collection_provider_id"></a>
143-
144-
1. collection provider ID : clickhouse (this will be used in the collections config under the collection_provider section)
145-
146-
2. classname : ["clickhouse_collection_provider\.ClickhouseCollectionProvider"](pydggsapi/dependencies/collections_providers/clickhouse_collection_provider.py) the implementation of the class (under [dependencies/collections_providers folder](pydggsapi/dependencies/collections_providers))
147-
148-
3. initial_params : parameters to initializing the class
149-
150-
```
151-
"collection_providers": {"1":
152-
{"clickhouse":
153-
{"classname": "clickhouse_collection_provider.ClickhouseCollectionProvider",
154-
"initial_params":
155-
{"host": "127.0.0.1",
156-
"user": "user",
157-
"password": "password",
158-
"port": 9000,
159-
"database": "DevelopmentTesting"}
160-
}
161-
}
162-
}
163-
```
164-
165-
**Collection provider - Zarr**
166-
167-
Collection provider to support Zarr data format with Xarray DataTree.
168-
169-
- The Zarr collection provider uses xarray to support Zarr data format
170-
- Each refinement level (resolution) is treated as a group in Zarr
171-
- It will return all data variables
172-
- It holds a dictionary to the xarray object for each data source.
173-
- Data sources (folder path) can be specified in either:
174-
- initial_params will load the data source at the start.
175-
176-
Data source defined in init_params
177-
178-
```
179-
"collection_providers": {"2":
180-
{"zarr":
181-
{"classname": "zarr_collection_provider.ZarrCollectionProvider",
182-
"initial_params": {
183-
"datasources": {
184-
"my_zarr_data": {
185-
"filepath": "<path to zarr folder>",
186-
"zones_grps" : { "4": "res4", "5": "res5"}
187-
}
188-
}
189-
}
190-
}
191-
}
192-
}
193-
```
194-
195-
Data source defined in Collections
196-
197-
- The datasource_id `my_zarr_data` must match with the id that defined in above ZarrCollectionProvider.
198-
199-
```
200-
"collections": {"2":
201-
{"suitability_hytruck_zarr":
202-
{"title": "Suitability Modelling for Hytruck for Zarr Data format",
203-
"description": "Desc",
204-
"collection_provider": {
205-
"providerId": "zarr",
206-
"dggrsId": "igeo7",
207-
"maxzonelevel": 9,
208-
"getdata_params": {
209-
datasource_id: "my_zarr_data",
210-
"filepath": "<path to zarr folder>",
211-
"zones_grps" : { "4": "res4", "5": "res5"}
212-
}
213-
}
214-
}
215-
}
216-
}
217-
}
218-
```
219-
220-
#### An example for DGGRS providers definition (in TinyDB):
221-
222-
The following configuration defines a dggrs provider with :
223-
224-
<a name="dggrs_provider_id"></a>
225-
226-
1. dggrs provider ID : igeo7 and h3 (this will be used in the collections config under the collection_provider section)
227-
228-
2. ogc dggs API required descriptions for dggrs. (ex. title, shapeType etc.)
22966

230-
3. classname : "igeo7_dggrs_provider\.IGEO7Provider", "h3_dggrs_provider\.H3Provider" the implementation class info (under [dependencies/dggrs_providers folder](pydggsapi/dependencies/dggrs_providers))
23167

232-
```
233-
"dggrs": {"1":
234-
{"igeo7":
235-
{"title": "ISEA7H z7string",
236-
"description": "desc",
237-
"crs": "wgs84",
238-
"shapeType": "hexagon",
239-
"definition_link": "http://testing",
240-
"defaultDepth": 5,
241-
"classname": "igeo7_dggrs_provider.IGEO7Provider" }
242-
},
243-
"2":
244-
{"h3":
245-
{"title": "h3",
246-
"description": "desc",
247-
"crs": "wgs84",
248-
"shapeType": "hexagon",
249-
"definition_link": "http://h3test",
250-
"defaultDepth": 5,
251-
"classname": "h3_dggrs_provider.H3Provider"}
252-
}
253-
}
254-
```
25568

25669
## Acknowledgments
25770

0 commit comments

Comments
 (0)