Skip to content

Commit 76589b7

Browse files
authored
Merge branch 'geopython:master' into deploy
2 parents db99c2d + 4e050e9 commit 76589b7

Some content is hidden

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

78 files changed

+2592
-490
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,26 @@ jobs:
2424
- python-version: '3.10'
2525
env:
2626
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"
27+
28+
services:
29+
postgres:
30+
image: postgis/postgis:14-3.2
31+
ports:
32+
- 5432:5432
33+
env:
34+
POSTGRES_DB: test
35+
POSTGRES_PASSWORD: ${{ secrets.DatabasePassword || 'postgres' }}
2736

2837
steps:
38+
- name: Pre-pull Docker Images
39+
run: |
40+
docker pull container-registry.oracle.com/database/express:21.3.0-xe &
41+
docker pull appropriate/curl:latest &
42+
docker pull elasticsearch:8.17.0 &
43+
docker pull opensearchproject/opensearch:2.18.0 &
44+
docker pull mongo:8.0.4 &
45+
docker pull ghcr.io/cgs-earth/sensorthings-action:0.1.0 &
46+
docker pull postgis/postgis:14-3.2 &
2947
- name: Clear up GitHub runner diskspace
3048
run: |
3149
echo "Space before"
@@ -48,11 +66,16 @@ jobs:
4866
sudo sysctl -w vm.swappiness=1
4967
sudo sysctl -w fs.file-max=262144
5068
sudo sysctl -w vm.max_map_count=262144
51-
- name: Install and run PostgreSQL/PostGIS 📦
52-
uses: huaxk/postgis-action@v1
69+
- name: "Install and run MySQL 📦"
70+
uses: mirromutth/mysql-action@v1.1
5371
with:
54-
postgresql password: ${{ secrets.DatabasePassword || 'postgres' }}
55-
postgresql db: 'test'
72+
host port: 3306
73+
mysql version: '8.0'
74+
mysql database: test_geo_app
75+
mysql root password: mysql # This is a dummy password here; not actually used in prod
76+
mysql user: pygeoapi
77+
mysql password: mysql
78+
5679
- name: Install and run Elasticsearch 📦
5780
uses: getong/elasticsearch-action@v1.2
5881
with:
@@ -111,6 +134,7 @@ jobs:
111134
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/dummy_data.sql
112135
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/dummy_types_data.sql
113136
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/postgres_manager_full_structure.backup.sql
137+
mysql -h 127.0.0.1 -P 3306 -u root -p'mysql' test_geo_app < tests/data/mysql_data.sql
114138
docker ps
115139
python3 tests/load_oracle_data.py
116140
- name: run unit tests ⚙️
@@ -119,6 +143,7 @@ jobs:
119143
run: |
120144
pytest tests/api
121145
pytest tests/test_api_ogr_provider.py
146+
pytest tests/test_base_provider.py
122147
pytest tests/test_config.py
123148
pytest tests/test_csv__formatter.py
124149
pytest tests/test_csv__provider.py
@@ -142,6 +167,8 @@ jobs:
142167
pytest tests/test_oracle_provider.py
143168
pytest tests/test_parquet_provider.py
144169
pytest tests/test_postgresql_provider.py
170+
pytest tests/test_postgresql_mvt_provider.py
171+
pytest tests/test_mysql_provider.py
145172
pytest tests/test_rasterio_provider.py
146173
pytest tests/test_sensorthings_edr_provider.py
147174
pytest tests/test_sensorthings_provider.py

CONTRIBUTING.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Your contribution will be under our [license](https://github.com/geopython/pygeo
6565
* Pull requests may include copyright in the source code header by the contributor if the contribution is significant or the contributor wants to claim copyright on their contribution.
6666
* All contributors shall be listed at https://github.com/geopython/pygeoapi/graphs/contributors
6767
* Unclaimed copyright, by default, is assigned to the main copyright holders as specified in https://github.com/geopython/pygeoapi/blob/master/LICENSE.md
68+
* further notes can be found in the [documentation](https://docs.pygeoapi.io/en/latest/development.html#testing)
6869

6970
### Version Control Branching
7071

@@ -89,16 +90,23 @@ Your contribution will be under our [license](https://github.com/geopython/pygeo
8990
while, __make sure you rebase or merge to latest ``master``__ to ensure a
9091
speedier resolution.
9192

93+
### Testing
94+
95+
* testing is performed using [pytest](https://pytest.org) and covers all major components (API core, providers, formatters, managers, etc.)
96+
* additional information can be found in the [documentation](https://docs.pygeoapi.io/en/latest/development.html#testing)
97+
98+
9299
### Documentation
93100

94101
* documentation is managed in `docs/`, in reStructuredText format
95102
* [Sphinx](https://www.sphinx-doc.org) is used to generate the documentation
96103
* See the [reStructuredText Primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) on rST markup and syntax
104+
* additional information can be found in the [documentation](https://docs.pygeoapi.io/en/latest/development.html#building-the-documentation)
97105

98106

99107
### Wiki
100108

101-
* the [pygeoapi wiki](https://github.com/geopython/pygeoapi/wiki) provides working level documentation
109+
* the [pygeoapi wiki](https://github.com/geopython/pygeoapi/wiki) provides working level documentation and various community resources
102110

103111

104112
### Code Formatting
@@ -107,7 +115,8 @@ Your contribution will be under our [license](https://github.com/geopython/pygeo
107115
* pygeoapi follows the [PEP-8](http://www.python.org/dev/peps/pep-0008/) guidelines
108116
* 80 characters
109117
* spaces, not tabs
110-
* pygeoapi, instead of PyGeoAPI, pygeoAPI, etc.
118+
* pygeoapi, NOT PyGeoAPI, pygeoAPI, etc.
119+
* additional information can be found in the [documentation](https://docs.pygeoapi.io/en/latest/development.html#linting)
111120

112121
## Suggesting Enhancements
113122

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ ARG ADD_DEB_PACKAGES="\
6969
python3-netcdf4 \
7070
python3-pandas \
7171
python3-psycopg2 \
72+
python3-pydantic \
7273
python3-pymongo \
7374
python3-pyproj \
7475
python3-rasterio \

docs/source/configuration.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ For more information related to API design rules (the ``api_rules`` property in
4242
host: 0.0.0.0 # listening address for incoming connections
4343
port: 5000 # listening port for incoming connections
4444
url: http://localhost:5000/ # url of server
45+
icon: https://example.org/favicon.ico # favicon / shortcut icon for default HTML template customization
46+
logo: https://example.org/logo.png # logo/banner for default HTML template customization
4547
mimetype: application/json; charset=UTF-8 # default MIME type
4648
encoding: utf-8 # default server encoding
4749
language: en-US # default server language

docs/source/contributing.rst

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,5 @@
33
Contributing
44
============
55

6-
Building the documentation
7-
--------------------------
8-
9-
To build the documentation in pygeoapi we use `Sphinx`_. The documentation is located in the docs folder.
10-
11-
.. note::
12-
For the following instructions to work, you must be located in the root folder of pygeoapi.
13-
14-
Install the dependencies necessary for building the documentation using the following command:
15-
16-
.. code-block:: bash
17-
18-
pip3 install -r docs/requirements.txt
19-
20-
After installing the requirements, build the documentation using the ``sphinx-build`` command:
21-
22-
.. code-block:: bash
23-
24-
sphinx-build -M html docs/source docs/build
25-
26-
27-
Or using the following ``make`` command:
28-
29-
.. code-block:: bash
30-
31-
make -C docs html
32-
33-
After building the documentation, the folder ``docs/build`` will contain the website generated with the documentation.
34-
Add the folder to a web server or open the file ``docs/build/html/index.html`` file in a web browser to see the contents of the documentation.
35-
36-
The documentation is hosted on `readthedocs`_. It is automatically generated from the contents of the ``master`` branch on GitHub.
37-
38-
The file ``.readthedocs.yaml`` contains the configuration of the readthedocs build. Refer to the `readthedocs configuration file`_ documentation for more information.
39-
40-
Contributing GitHub page
41-
------------------------
42-
436
Please see the `Contributing page <https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md>`_
447
for information on contributing to the project.
45-
46-
.. _`Sphinx`: https://www.djangoproject.com
47-
.. _`readthedocs`: https://docs.readthedocs.io/en/stable/index.html
48-
.. _readthedocs configuration file: https://docs.readthedocs.io/en/stable/config-file/v2.html

docs/source/crs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Metadata
3030
The conformance class `http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs` is present as a `conformsTo` field
3131
in the root landing page response.
3232

33-
The configured CRSs, or their defaults, `crs` and `storageCRS` and optionally `storageCrsCoordinateEpoch` will be present in the "Describe Collection" response.
33+
The configured CRSs, or their defaults, `crs` and `storageCrs` and optionally `storageCrsCoordinateEpoch` will be present in the "Describe Collection" response.
3434

3535
Parameters
3636
----------
@@ -95,7 +95,7 @@ Suppose an addresses collection with the following CRS support in its collection
9595
"http://www.opengis.net/def/crs/EPSG/0/28992",
9696
"http://www.opengis.net/def/crs/OGC/1.3/CRS84"
9797
],
98-
"storageCRS": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
98+
"storageCrs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
9999
100100
101101
This allows a `bbox-crs` query using Dutch "RD" coordinates with CRS `http://www.opengis.net/def/crs/EPSG/0/28992` to retrieve

docs/source/data-publishing/ogcapi-edr.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The `xarray-edr`_ provider plugin reads and extracts `NetCDF`_ and `Zarr`_ data
5555
# to derive automagically
5656
x_field: lon
5757
y_field: lat
58+
z_field: z
5859
time_field: time
5960
# optionally specify the coordinate reference system of your dataset
6061
# else pygeoapi assumes it is WGS84 (EPSG:4326).

docs/source/data-publishing/ogcapi-features.rst

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ parameters.
1919
:header: Provider, property filters/display, resulttype, bbox, datetime, sortby, skipGeometry, domains, CQL, transactions, crs
2020
:align: left
2121

22-
`CSV`_,✅/✅,results/hits,,❌,❌,✅,❌,❌,❌,✅
22+
`CSV`_,✅/✅,results/hits,,❌,❌,✅,❌,❌,❌,✅
2323
`Elasticsearch`_,✅/✅,results/hits,✅,✅,✅,✅,✅,✅,✅,✅
2424
`ERDDAP Tabledap Service`_,❌/❌,results/hits,✅,✅,❌,❌,❌,❌,❌,✅
2525
`ESRI Feature Service`_,✅/✅,results/hits,✅,✅,✅,✅,❌,❌,❌,✅
26-
`GeoJSON`_,✅/✅,results/hits,,❌,❌,✅,❌,❌,❌,✅
26+
`GeoJSON`_,✅/✅,results/hits,,❌,❌,✅,❌,❌,❌,✅
2727
`MongoDB`_,✅/❌,results,✅,✅,✅,✅,❌,❌,❌,✅
28+
`MySQL`_,✅/✅,results/hits,✅,✅,✅,✅,❌,✅,✅,✅
2829
`OGR`_,✅/❌,results/hits,✅,❌,❌,✅,❌,❌,❌,✅
2930
`OpenSearch`_,✅/✅,results/hits,✅,✅,✅,✅,❌,✅,✅,✅
3031
`Oracle`_,✅/✅,results/hits,✅,❌,✅,✅,❌,❌,❌,✅
@@ -222,6 +223,76 @@ Here `test` is the name of database , `points` is the target collection name.
222223
data: mongodb://localhost:27017/testdb
223224
collection: testplaces
224225
226+
227+
.. _MySQL:
228+
229+
MySQL
230+
^^^^^
231+
232+
.. note::
233+
Requires Python packages sqlalchemy, geoalchemy2 and pymysql
234+
235+
Must have MySQL installed.
236+
237+
.. code-block:: yaml
238+
239+
providers:
240+
- type: feature
241+
name: MySQL
242+
data:
243+
host: 127.0.0.1
244+
port: 3306 # Default 3306 if not provided
245+
dbname: test_geo_app
246+
user: mysql
247+
password: mysql
248+
search_path: [test_geo_app] # Same as dbname
249+
id_field: locationID
250+
table: location
251+
geom_field: locationCoordinates
252+
253+
A number of database connection options can be also configured in the provider in order to adjust properly the sqlalchemy engine client.
254+
These are optional and if not specified, the default from the engine will be used. Please see also `SQLAlchemy docs <https://docs.sqlalchemy.org/en/14/core/engines.html#custom-dbapi-connect-arguments-on-connect-routines>`_.
255+
256+
.. code-block:: yaml
257+
258+
providers:
259+
- type: feature
260+
name: MySQL
261+
data:
262+
host: 127.0.0.1
263+
port: 3306 # Default 3306 if not provided
264+
dbname: test_geo_app
265+
user: mysql
266+
password: mysql
267+
search_path: [test_geo_app] # Same as dbname
268+
options:
269+
# Maximum time to wait while connecting, in seconds.
270+
connect_timeout: 10
271+
# Number of *milliseconds* that transmitted data may remain
272+
# unacknowledged before a connection is forcibly closed.
273+
tcp_user_timeout: 10000
274+
# Whether client-side TCP keepalives are used. 1 = use keepalives,
275+
# 0 = don't use keepalives.
276+
keepalives: 1
277+
# Number of seconds of inactivity after which TCP should send a
278+
# keepalive message to the server.
279+
keepalives_idle: 5
280+
# Number of TCP keepalives that can be lost before the client's
281+
# connection to the server is considered dead.
282+
keepalives_count: 5
283+
# Number of seconds after which a TCP keepalive message that is not
284+
# acknowledged by the server should be retransmitted.
285+
keepalives_interval: 1
286+
id_field: locationID
287+
table: location
288+
geom_field: locationCoordinates
289+
290+
This provider has support for the CQL queries as indicated in the Provider table above.
291+
292+
.. seealso::
293+
:ref:`cql` for more details on how to use Common Query Language (CQL) to filter the collection with specific queries.
294+
295+
225296
OGR
226297
^^^
227298

docs/source/data-publishing/ogcapi-tiles.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pygeoapi core tile providers are listed below, along with supported features.
2222
`MVT-elastic`_,✅,✅,✅,❌,❌,✅
2323
`MVT-proxy`_,❓,❓,❓,❓,❌,✅
2424
`WMTSFacade`_,✅,❌,✅,✅,✅,❌
25+
`MVT-postgresql`_,✅,✅,✅,✅,❌,✅
2526

2627
Below are specific connection examples based on supported providers.
2728

@@ -130,6 +131,48 @@ Following code block shows how to configure pygeoapi to read Mapbox vector tiles
130131
name: pbf
131132
mimetype: application/vnd.mapbox-vector-tile
132133
134+
MVT-postgresql
135+
^^^^^^^^^^^^^^
136+
137+
.. note::
138+
Requires Python packages sqlalchemy, geoalchemy2 and psycopg2-binary
139+
140+
.. note::
141+
Must have PostGIS installed with protobuf-c support
142+
143+
This provider gives support to serving tiles generated using `PostgreSQL <https://www.postgresql.org/>`_ with `PostGIS <https://postgis.net/>`_.
144+
The tiles are rendered on-the-fly using `ST_AsMVT <https://postgis.net/docs/ST_AsMVT.html>`_ and related methods.
145+
146+
This code block shows how to configure pygeoapi to render Mapbox vector tiles from a PostGIS table.
147+
148+
.. code-block:: yaml
149+
150+
providers:
151+
- type: tile
152+
name: MVT-postgresql
153+
data:
154+
host: 127.0.0.1
155+
port: 3010 # Default 5432 if not provided
156+
dbname: test
157+
user: postgres
158+
password: postgres
159+
search_path: [osm, public]
160+
id_field: osm_id
161+
table: hotosm_bdi_waterways
162+
geom_field: foo_geom
163+
storage_crs: http://www.opengis.net/def/crs/EPSG/0/4326
164+
options:
165+
zoom:
166+
min: 0
167+
max: 15
168+
format:
169+
name: pbf
170+
mimetype: application/vnd.mapbox-vector-tile
171+
172+
.. tip::
173+
Geometry must have correctly defined :ref:`storage_crs<crs>`
174+
175+
PostgreSQL-related connection options can also be added to `options`. Please refer to the :ref:`PostgreSQL OGC Features Provider<PostgreSQL>` documentation for more information.
133176

134177
WMTSFacade
135178
^^^^^^^^^^

0 commit comments

Comments
 (0)