MVT Provider refactoring (#1454)

* - Refactor MVTProvider, to support subclassing
- Added provider for MVT Tippecanoe

* - fixed test configuration for the MVT tippecanoe provider

* - added MVT elastic provider

* - added documentation for mvt providers
- fixed formatting

* - removed tiles publishing from elastic provider example
- updated gitignore to ignore data folder from elastic example

* - added docker example for MVT-elastic backend provider

* - Added docker example for tippecanoe MVT provider

* - updated README of the docker examples section, to catch up with the provided examples.

* - renamed mvt-elastic and mvt-tippecanoe docker example folders.

* - renamed elastic and tippecanoe folders to lower case

* - fixed formatting issue

* - s/Mabox/Mapbox/

* - put plugin provider names in single line

* - renamed MVT provider base class to BaseMVTProvider.

* - added MVT base class

* - reviwed uppercase on .gitignore
- add folder to .gitignore

* - removed new line and brackets

* - removed redundant line with base class

---------

Co-authored-by: doublebyte1 <info@doublebyte.net>
This commit is contained in:
Jo
2023-12-28 21:23:54 +00:00
committed by GitHub
parent b78d28bcfd
commit fc31cb3e73
20 changed files with 1188 additions and 184 deletions
+31 -45
View File
@@ -7,50 +7,42 @@ Publishing tiles to OGC API - Tiles
(map, vector, coverage, etc.).
pygeoapi can publish tiles from local or remote data sources (including cloud
object storage or a tile service). To integrate tiles from a local data source, it is assumed
that a directory tree of static tiles has been created on disk. Examples of
tile generation software include (but are not limited to):
* `MapProxy`_
* `tippecanoe`_
object storage or a tile service).
Providers
---------
pygeoapi core tile providers are listed below, along with supported storage types.
pygeoapi core tile providers are listed below, along with supported features.
.. csv-table::
:header: Provider, local, remote
:header: Provider, rendered on-the-fly, properties
:align: left
`MVT`_,,✅
`MVT-tippecanoe`_,,✅
`MVT-elastic`_,✅,❌
Below are specific connection examples based on supported providers.
.. note::
Currently only `Mapbox Vector Tiles (MVT) <https://github.com/mapbox/vector-tile-spec>`_ are supported in pygeoapi.
Connection examples
-------------------
MVT
^^^
MVT-tippecanoe
^^^^^^^^^^^^^^
The MVT provider plugin provides access to `Mapbox Vector Tiles`_.
This provider gives support to serving tiles generated using `Mapbox Tippecanoe <https://github.com/mapbox/tippecanoe>`_.
The tiles can be integrated from a path on disk, or from a static url (e.g.: from an S3 or MinIO bucket).
In both cases, they have to be rendered before using pygeoapi.
Remote data sources can be any external service (i.e. Elasticsearch), by providing a URL
template.
.. note::
Currently, the URL templating in this provider supports the following formats: `/{z}/{x}/{y}` or `/{z}/{y}/{x}`.
For additional formats: feel free to file an `issue <https://github.com/geopython/pygeoapi/issues>`_.
This code block shows how to configure pygeoapi to read Mapbox vector tiles, from disk or a URL.
This code block shows how to configure pygeoapi to read Mapbox vector tiles generated with tippecanoe, from disk or a URL.
.. code-block:: yaml
providers:
- type: tile
name: MVT
name: MVT-tippecanoe
data: tests/data/tiles/ne_110m_lakes # local directory tree
# data: http://localhost:9000/ne_110m_lakes/{z}/{x}/{y}.pbf # tiles stored on a MinIO bucket
options:
@@ -64,13 +56,23 @@ This code block shows how to configure pygeoapi to read Mapbox vector tiles, fro
name: pbf
mimetype: application/vnd.mapbox-vector-tile
This code block shows how to configure pygeoapi to read Mapbox vector tiles, from an `Elasticsearch <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-vector-tile-api.html>`_ endpoint.
.. tip::
On `this tutorial <https://dive.pygeoapi.io/publishing/ogcapi-tiles/#publish-pre-rendered-vector-tiles>`_ you can find detailed instructions on how-to generate tiles using tippecanoe and integrate them into pygeoapi.
MVT-elastic
^^^^^^^^^^^^
This provider gives support to serving tiles generated using `Elasticsearch <https://www.elastic.co/>`_.
These tiles are rendered on-the-fly using the `Elasticsearch Vector tile search API <https://www.elastic.co/guide/en/elasticsearch/reference/current/search-vector-tile-api.html>`_.
In order to use it, the only requirement is to have the data stored in an Elasticsearch index.
This code block shows how to configure pygeoapi to read Mapbox vector tiles from an Elasticsearch endpoint.
.. code-block:: yaml
providers:
- type: tile
name: MVT
name: MVT-elastic
data: http://localhost:9200/ne_110m_populated_places_simple2/_mvt/geometry/{z}/{x}/{y}?grid_precision=0
# if you don't use precision 0, you will be requesting for aggregations which are not supported in the
# free version of elastic
@@ -85,25 +87,9 @@ This code block shows how to configure pygeoapi to read Mapbox vector tiles, fro
name: pbf
mimetype: application/vnd.mapbox-vector-tile
This code block shows how to configure pygeoapi to read Mapbox vector tiles, from a `pg_tileserv <https://access.crunchydata.com/documentation/pg_tileserv/1.0.8/introduction/>`_ endpoint.
.. code-block:: yaml
providers:
- type: tile
name: MVT
data: http://localhost:7800/public.ne_50m_admin_0_countries/{z}/{x}/{y}.pbf
options:
metadata_format: default # default | tilejson
zoom:
min: 0
max: 16
schemes:
- WorldCRS84Quad
format:
name: pbf
mimetype: application/vnd.mapbox-vector-tile
.. tip::
On `this tutorial <https://dive.pygeoapi.io/publishing/ogcapi-tiles/#publish-vector-tiles-from-elasticsearch>`_ you can find detailed instructions on publish tiles stored in an Elasticsearch endpoint.
Data access examples
--------------------
@@ -120,6 +106,6 @@ Data access examples
.. _`OGC API - Tiles`: https://github.com/opengeospatial/ogcapi-tiles
.. _`MapProxy`: https://mapproxy.org
.. _`tippecanoe`: https://github.com/mapbox/tippecanoe
.. _`Elasticsearch`: https://www.elastic.co/
.. _`Mapbox Vector Tiles`: https://docs.mapbox.com/data/tilesets/guides/vector-tiles-introduction/