Skip to content

Implement native SQL Alchemy MVT #2022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ jobs:
- python-version: '3.10'
env:
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"

services:
postgres:
image: postgis/postgis:14-3.2
ports:
- 5432:5432
env:
POSTGRES_DB: test
POSTGRES_PASSWORD: ${{ secrets.DatabasePassword || 'postgres' }}

steps:
- name: Pre-pull Docker Images
Expand All @@ -32,7 +41,6 @@ jobs:
docker pull appropriate/curl:latest &
docker pull elasticsearch:8.17.0 &
docker pull opensearchproject/opensearch:2.18.0 &
docker pull mdillon/postgis:latest &
docker pull mongo:8.0.4 &
docker pull ghcr.io/cgs-earth/sensorthings-action:0.1.0 &
docker pull postgis/postgis:14-3.2 &
Expand All @@ -58,12 +66,6 @@ jobs:
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Install and run PostgreSQL/PostGIS 📦
uses: huaxk/postgis-action@v1
with:
postgresql password: ${{ secrets.DatabasePassword || 'postgres' }}
postgresql db: 'test'

- name: "Install and run MySQL 📦"
uses: mirromutth/mysql-action@v1.1
with:
Expand Down Expand Up @@ -164,6 +166,7 @@ jobs:
pytest tests/test_oracle_provider.py
pytest tests/test_parquet_provider.py
pytest tests/test_postgresql_provider.py
pytest tests/test_postgresql_mvt_provider.py
pytest tests/test_mysql_provider.py
pytest tests/test_rasterio_provider.py
pytest tests/test_sensorthings_edr_provider.py
Expand Down
43 changes: 22 additions & 21 deletions docs/source/data-publishing/ogcapi-tiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ MVT-postgresql
.. note::
Must have PostGIS installed with protobuf-c support

.. note::
Geometry must be using EPSG:4326

This provider gives support to serving tiles generated using `PostgreSQL <https://www.postgresql.org/>`_ with `PostGIS <https://postgis.net/>`_.
The tiles are rendered on-the-fly using `ST_AsMVT <https://postgis.net/docs/ST_AsMVT.html>`_ and related methods.

Expand All @@ -152,24 +149,28 @@ This code block shows how to configure pygeoapi to render Mapbox vector tiles fr

providers:
- type: tile
name: MVT-postgresql
data:
host: 127.0.0.1
port: 3010 # Default 5432 if not provided
dbname: test
user: postgres
password: postgres
search_path: [osm, public]
id_field: osm_id
table: hotosm_bdi_waterways
geom_field: foo_geom
options:
zoom:
min: 0
max: 15
format:
name: pbf
mimetype: application/vnd.mapbox-vector-tile
name: MVT-postgresql
data:
host: 127.0.0.1
port: 3010 # Default 5432 if not provided
dbname: test
user: postgres
password: postgres
search_path: [osm, public]
id_field: osm_id
table: hotosm_bdi_waterways
geom_field: foo_geom
storage_crs: http://www.opengis.net/def/crs/EPSG/0/4326
options:
zoom:
min: 0
max: 15
format:
name: pbf
mimetype: application/vnd.mapbox-vector-tile

.. tip::
Geometry must have correctly defined :ref:`storage_crs<crs>`

PostgreSQL-related connection options can also be added to `options`. Please refer to the :ref:`PostgreSQL OGC Features Provider<PostgreSQL>` documentation for more information.

Expand Down
2 changes: 1 addition & 1 deletion pygeoapi/api/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def get_collection_tiles_data(
if content is None:
msg = 'identifier not found'
return api.get_exception(
HTTPStatus.NO_CONTENT, headers, format_, 'NocContent', msg)
HTTPStatus.NO_CONTENT, headers, format_, 'NoContent', msg)
else:
return headers, HTTPStatus.OK, content

Expand Down
Loading