Skip to content

Commit 332c806

Browse files
committed
03/10 merge with upstream pygeoapi and handle conflict
2 parents 9c608b3 + 939d373 commit 332c806

99 files changed

Lines changed: 14233 additions & 1086 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
- python-version: '3.12'
2525
env:
2626
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"
27+
DOCKER_API_VERSION: "1.44"
2728

2829
services:
2930
postgres:
@@ -42,7 +43,6 @@ jobs:
4243
docker pull elasticsearch:8.17.0 &
4344
docker pull opensearchproject/opensearch:2.18.0 &
4445
docker pull mongo:8.0.4 &
45-
docker pull ghcr.io/cgs-earth/sensorthings-action:0.1.0 &
4646
docker pull postgis/postgis:14-3.2 &
4747
- name: Clear up GitHub runner diskspace
4848
run: |
@@ -96,7 +96,7 @@ jobs:
9696
with:
9797
mongodb-version: '8.0.4'
9898
- name: Install and run SensorThingsAPI
99-
uses: cgs-earth/sensorthings-action@v0.1.0
99+
uses: cgs-earth/sensorthings-action@v0.1.2
100100
- name: Install sqlite and gpkg dependencies
101101
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
102102
with:
@@ -126,6 +126,7 @@ jobs:
126126
pip3 install -r requirements-provider.txt
127127
pip3 install -r requirements-manager.txt
128128
pip3 install -r requirements-django.txt
129+
pip3 install -r requirements-pubsub.txt
129130
pip3 install .
130131
pip3 install GDAL==`gdal-config --version`
131132
- name: setup test data ⚙️

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Francesco Bartoli <xbartolone@gmail.com>
66
# Angelos Tzotsos <gcpp.kalxas@gmail.com>
77
#
8-
# Copyright (c) 2025 Tom Kralidis
8+
# Copyright (c) 2026 Tom Kralidis
99
# Copyright (c) 2019 Just van den Broecke
1010
# Copyright (c) 2025 Francesco Bartoli
1111
# Copyright (c) 2025 Angelos Tzotsos
@@ -34,7 +34,7 @@
3434
#
3535
# =================================================================
3636

37-
FROM ubuntu:noble-20251013
37+
FROM ubuntu:noble
3838

3939
LABEL maintainer="Just van den Broecke <justb4@gmail.com>"
4040

@@ -133,7 +133,7 @@ ADD . /pygeoapi
133133
RUN python3 -m venv --system-site-packages /venv \
134134
&& /venv/bin/python3 -m pip install --no-cache-dir -r requirements-docker.txt \
135135
&& /venv/bin/python3 -m pip install --no-cache-dir -r requirements-admin.txt \
136-
&& /venv/bin/python3 -m pip install --no-cache-dir gunicorn \
136+
&& /venv/bin/python3 -m pip install --no-cache-dir "gunicorn<24" \
137137
&& /venv/bin/python3 -m pip install --no-cache-dir -e .
138138

139139
# Set default config and entrypoint for Docker Image

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ The pygeoapi Project Steering Committee (PSC) will release patches for security
1313

1414
| Version | Supported |
1515
| ------- | ------------------ |
16-
| 0.10.x | :white_check_mark: |
17-
| < 0.10 | :x: |
16+
| 0.2x | :white_check_mark: |
17+
| < 0.20 | :x: |

docker/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ fi
4646
if [[ -z "$PYGEOAPI_OPENAPI" ]]; then
4747
export PYGEOAPI_OPENAPI="${PYGEOAPI_HOME}/local.openapi.yml"
4848
fi
49+
if [[ -z "$PYGEOAPI_ASYNCAPI" ]]; then
50+
export PYGEOAPI_ASYNCAPI="${PYGEOAPI_HOME}/local.asyncapi.yml"
51+
fi
4952

5053
# gunicorn env settings with defaults
5154
SCRIPT_NAME=${SCRIPT_NAME:=/}
@@ -87,6 +90,11 @@ echo "Trying to generate openapi.yml"
8790

8891
echo "openapi.yml generated continue to pygeoapi"
8992

93+
echo "Trying to generate asyncapi.yml"
94+
/venv/bin/pygeoapi asyncapi generate ${PYGEOAPI_CONFIG} --output-file ${PYGEOAPI_ASYNCAPI}
95+
96+
[[ $? -ne 0 ]] && echo "asyncapi.yml could not be generated; skipping"
97+
9098
start_gunicorn() {
9199
# SCRIPT_NAME should not have value '/'
92100
[[ "${SCRIPT_NAME}" = '/' ]] && export SCRIPT_NAME="" && echo "make SCRIPT_NAME empty from /"

docs/source/administration.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ To generate the OpenAPI document, run the following:
2424
2525
This will dump the OpenAPI document as YAML to your system's ``stdout``. To save to a file on disk, run:
2626

27-
.. code-block:: bash
28-
29-
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml > /path/to/my-pygeoapi-openapi.yml
30-
31-
You can also write to a file explicitly via the ``--output-file`` option:
32-
3327
.. code-block:: bash
3428
3529
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml --output-file /path/to/my-pygeoapi-openapi.yml
@@ -38,7 +32,7 @@ To generate the OpenAPI document as JSON, run:
3832

3933
.. code-block:: bash
4034
41-
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml -f json > /path/to/my-pygeoapi-openapi.json
35+
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml --format json --output-file /path/to/my-pygeoapi-openapi.json
4236
4337
.. note::
4438
Generate as YAML or JSON? If your OpenAPI YAML definition is slow to render as JSON,
@@ -83,6 +77,11 @@ In UNIX:
8377
# or if OpenAPI JSON
8478
export PYGEOAPI_OPENAPI=/path/to/my-pygeoapi-openapi.json
8579
80+
# if your server supports AsyncAPI and Pub/Sub
81+
export PYGEOAPI_ASYNCAPI=/path/to/my-pygeoapi-asyncapi.yml
82+
# or if AsyncAPI JSON
83+
export PYGEOAPI_ASYNCAPI=/path/to/my-pygeoapi-asyncapi.json
84+
8685
In Windows:
8786

8887
.. code-block:: bat
@@ -92,6 +91,14 @@ In Windows:
9291
# or if OpenAPI JSON
9392
set PYGEOAPI_OPENAPI=/path/to/my-pygeoapi-openapi.json
9493
94+
# if your server supports AsyncAPI and Pub/Sub
95+
set PYGEOAPI_ASYNCAPI=/path/to/my-pygeoapi-asyncapi.yml
96+
# or if AsyncAPI JSON
97+
set PYGEOAPI_ASYNCAPI=/path/to/my-pygeoapi-asyncapi.json
98+
99+
.. note::
100+
101+
More information on AsyncAPI and Pub/Sub can be found at :ref:`pubsub`.
95102

96103
Summary
97104
-------

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __getattr__(cls, name):
112112
# built documents.
113113
#
114114
# The short X.Y version.
115-
version = '0.23.dev0'
115+
version = '0.24.dev0'
116116
# The full version, including alpha/beta/rc tags.
117117
release = version
118118

docs/source/configuration.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ file whatever you wish; typical filenames end with ``.yml``.
1414
pygeoapi configuration contains the following core sections:
1515

1616
- ``server``: server-wide settings
17+
- ``pubsub``: Publish-Subscribe settings (optional)
1718
- ``logging``: logging configuration
1819
- ``metadata``: server-wide metadata (contact, licensing, etc.)
1920
- ``resources``: dataset collections, processes and stac-collections offered by the server
@@ -90,6 +91,23 @@ For more information related to API design rules (the ``api_rules`` property in
9091
url_prefix: 'v{api_major}' # adds a /v1 prefix to all URL paths
9192
version_header: X-API-Version # add a response header of this name with the API version
9293
94+
``pubsub``
95+
^^^^^^^^^^
96+
97+
The ``pubsub`` section provides directives for enabling publication of CloudEvent messaages on item-based transactions
98+
99+
100+
.. code-block:: yaml
101+
102+
pubsub:
103+
name: MQTT
104+
broker:
105+
url: mqtt://localhost:1883
106+
channel: my/service/topic
107+
108+
.. seealso::
109+
:ref:`pubsub` for more information on Publish-Subscribe capabilities
110+
93111

94112
``logging``
95113
^^^^^^^^^^^
@@ -225,6 +243,14 @@ default.
225243
begin: 2000-10-30T18:24:39Z # start datetime in RFC3339
226244
end: 2007-10-30T08:57:29Z # end datetime in RFC3339
227245
trs: http://www.opengis.net/def/uom/ISO-8601/0/Gregorian # TRS
246+
resolution: P1D # ISO 8601 duration
247+
default: 2000-10-30T18:24:39Z # default time
248+
# additional extents can be added as desired (1..n)
249+
foo:
250+
url: https://example.org/def # required URL of the extent
251+
range: [0, 10] # required overall range/extent
252+
units: °C # optional units
253+
values: [0, 2, 5, 5, 10] # optional, enumeration of values
228254
providers: # list of 1..n required connections information
229255
- type: feature # underlying data geospatial type. Allowed values are: feature, coverage, record, tile, edr
230256
name: CSV # required: plugin name or import path. See Plugins section for more information.

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ reference documentation on all aspects of the project.
3939
openapi
4040
publishing/index
4141
transactions
42+
pubsub
4243
admin-api
4344
security
4445
plugins

docs/source/plugins.rst

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@ The core pygeoapi plugin registry can be found in ``pygeoapi.plugin.PLUGINS``.
3030

3131
Each plugin type implements its relevant base class as the API contract:
3232

33-
* data providers: ``pygeoapi.provider.base``
34-
* output formats: ``pygeoapi.formatter.base``
35-
* processes: ``pygeoapi.process.base``
36-
* process_manager: ``pygeoapi.process.manager.base``
33+
* data providers:
34+
35+
* features/records/maps: ``pygeoapi.provider.base.BaseProvider``
36+
* edr: ``pygeoapi.provider.base_edr.BaseEDRProvider``
37+
* tiles: ``pygeoapi.provider.tile.BaseTileProvider``
38+
39+
* output formats: ``pygeoapi.formatter.base.BaseFormatter``
40+
* processes: ``pygeoapi.process.base.BaseProcessor``
41+
* process_manager: ``pygeoapi.process.manager.base.BaseManager``
3742

3843
.. todo:: link PLUGINS to API doc
3944

@@ -150,7 +155,7 @@ option 2 above).
150155
Example: custom pygeoapi vector data provider
151156
---------------------------------------------
152157

153-
Lets consider the steps for a vector data provider plugin:
158+
Let's consider the steps for a vector data provider plugin:
154159

155160
Python code
156161
^^^^^^^^^^^
@@ -223,7 +228,7 @@ Each base class documents the functions, arguments and return types required for
223228
Example: custom pygeoapi raster data provider
224229
---------------------------------------------
225230

226-
Lets consider the steps for a raster data provider plugin:
231+
Let's consider the steps for a raster data provider plugin:
227232

228233
Python code
229234
^^^^^^^^^^^
@@ -278,6 +283,51 @@ Each base class documents the functions, arguments and return types required for
278283

279284
.. _example-custom-pygeoapi-processing-plugin:
280285

286+
Example: custom pygeoapi EDR data provider
287+
------------------------------------------
288+
289+
Let's consider the steps for an EDR data provider plugin:
290+
291+
Python code
292+
^^^^^^^^^^^
293+
294+
The below template provides a minimal example (let's call the file ``mycooledrdata.py``:
295+
296+
.. code-block:: python
297+
298+
from pygeoapi.provider.base_edr import BaseEDRProvider
299+
300+
class MyCoolEDRDataProvider(BaseEDRProvider):
301+
302+
def __init__(self, provider_def):
303+
"""Inherit from the parent class"""
304+
305+
super().__init__(provider_def)
306+
307+
self.covjson = {...}
308+
309+
def get_instances(self):
310+
return ['foo', 'bar']
311+
312+
def get_instance(self, instance):
313+
return instance in get_instances()
314+
315+
def position(self, **kwargs):
316+
return self.covjson
317+
318+
def trajectory(self, **kwargs):
319+
return self.covjson
320+
321+
322+
For brevity, the ``position`` function returns ``self.covjson`` which is a
323+
dictionary of a CoverageJSON representation. ``get_instances`` returns a list
324+
of instances associated with the collection/plugin, and ``get_instance`` returns
325+
a boolean of whether a given instance exists/is valid. EDR query types are subject
326+
to the query functions defined in the plugin. In the example above, the plugin
327+
implements ``position`` and ``trajectory`` queries, which will be advertised as
328+
supported query types.
329+
330+
281331
Example: custom pygeoapi processing plugin
282332
------------------------------------------
283333

@@ -360,6 +410,7 @@ Below is a sample process definition as a Python dictionary:
360410
'it back as output. Intended to demonstrate a simple '
361411
'process with a single literal input.',
362412
'jobControlOptions': ['sync-execute', 'async-execute'], # whether the process can be executed in sync or async mode
413+
'outputTransmission': ['value', 'reference'], # whether the process can return inline data or URL references
363414
'keywords': ['hello world', 'example', 'echo'], # keywords associated with the process
364415
'links': [{ # a list of 1..n # link objects relevant to the process
365416
'type': 'text/html',

docs/source/publishing/ogcapi-coverages.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,20 @@ The `Xarray`_ provider plugin reads and extracts `NetCDF`_ and `Zarr`_ data.
8989
format:
9090
name: zarr
9191
mimetype: application/zip
92+
options:
93+
zarr:
94+
consolidated: true
95+
squeeze: true
96+
9297
9398
.. note::
9499
`Zarr`_ files are directories with files and subdirectories. Therefore
95100
a zip file is returned upon request for said format.
96101

102+
.. note::
103+
104+
``options.zarr`` is a custom property that can be used to set `Zarr-specific open options`_.
105+
97106
.. note::
98107
When referencing `NetCDF`_ or `Zarr`_ data stored in an S3 bucket,
99108
be sure to provide the full S3 URL. Any parameters required to open the dataset
@@ -155,3 +164,4 @@ Data access examples
155164
.. _`Zarr`: https://zarr.readthedocs.io/en/stable
156165
.. _`GDAL raster driver short name`: https://gdal.org/drivers/raster/index.html
157166
.. _`pyproj.CRS.from_user_input`: https://pyproj4.github.io/pyproj/stable/api/crs/coordinate_system.html#pyproj.crs.CoordinateSystem.from_user_input
167+
.. _`Zarr-specific open options`: https://docs.xarray.dev/en/stable/generated/xarray.open_zarr.html

0 commit comments

Comments
 (0)