diff --git a/workshop/content/docs/assets/images/leaflet-hyderabad.png b/workshop/content/docs/assets/images/leaflet-hyderabad.png new file mode 100644 index 00000000..5408af00 Binary files /dev/null and b/workshop/content/docs/assets/images/leaflet-hyderabad.png differ diff --git a/workshop/content/docs/assets/images/qgis-vtiles2-hyderabad.png b/workshop/content/docs/assets/images/qgis-vtiles2-hyderabad.png new file mode 100644 index 00000000..301ee6ca Binary files /dev/null and b/workshop/content/docs/assets/images/qgis-vtiles2-hyderabad.png differ diff --git a/workshop/content/docs/assets/images/qgis-vtiles4-hyderabad.png b/workshop/content/docs/assets/images/qgis-vtiles4-hyderabad.png new file mode 100644 index 00000000..c364e55e Binary files /dev/null and b/workshop/content/docs/assets/images/qgis-vtiles4-hyderabad.png differ diff --git a/workshop/content/docs/assets/images/vtiles-es.png b/workshop/content/docs/assets/images/vtiles-es.png new file mode 100644 index 00000000..bdd528e8 Binary files /dev/null and b/workshop/content/docs/assets/images/vtiles-es.png differ diff --git a/workshop/content/docs/assets/images/vtiles-hyderabad.png b/workshop/content/docs/assets/images/vtiles-hyderabad.png new file mode 100644 index 00000000..b18d8004 Binary files /dev/null and b/workshop/content/docs/assets/images/vtiles-hyderabad.png differ diff --git a/workshop/content/docs/publishing/ogcapi-tiles.md b/workshop/content/docs/publishing/ogcapi-tiles.md index 5a3de302..d134bd18 100644 --- a/workshop/content/docs/publishing/ogcapi-tiles.md +++ b/workshop/content/docs/publishing/ogcapi-tiles.md @@ -4,8 +4,7 @@ title: Exercise 4 - Tiles of geospatial data via OGC API - Tiles # Exercise 4 - Tiles of geospatial data via OGC API - Tiles -[OGC API - Tiles](https://ogcapi.ogc.org/tiles) provides a Web API to deliver tiled data (bitmaps or vectors), -extending the functionalty other OGC API standards: +[OGC API - Tiles](https://ogcapi.ogc.org/tiles) provides a Web API to deliver tiles of geospatial information. Different forms of geospatial information are supported, such as tiles of vector features ("vector tiles"), coverages, maps (or imagery) and potentially eventually additional types of tiles of geospatial information. The standard is available on this document: * [OGC API - Tiles: Part 1: Core](https://docs.ogc.org/is/20-057/20-057.html) @@ -19,13 +18,7 @@ extending the functionalty other OGC API standards: ## pygeoapi support pygeoapi supports the core OGC API - Tiles specification, and is able to advertise an existing tileset. Note that pygeoapi -itself does not render tiles from source data (tiles must be pre-rendered before serving). Existing tools to create tiles -include, but are not limited to: - -* [TileMill](https://tilemill-project.github.io/tilemill) -* [MapProxy](https://mapproxy.org) -* [QGIS](https://www.qgistutorials.com/en/docs/creating_basemaps_with_qtiles.html) -* [tippecanoe](https://github.com/mapbox/tippecanoe) +itself does not render tiles from source data. It supports publishing pre-rendered tiles from a static url or from a tile server with a `xyz` url template. !!! note @@ -35,12 +28,19 @@ include, but are not limited to: See [the official documentation](https://docs.pygeoapi.io/en/latest/data-publishing/ogcapi-tiles.html) for more information on supported tile backends -## Publish a tile dataset +## Publish pre-rendered vector tiles -For this exercise, you will publish a vector dataset of cycle paths, from the city of Florence, from the locations below: +In this scenario, tiles must be pre-rendered before serving. Existing tools to create tiles +include, but are not limited to: -* data: `workshop/exercises/data/cycle-lanes-firenze.geojson` -* metadata: `workshop/exercises/data/cycle-lanes-firenze.qmd` +* [TileMill](https://tilemill-project.github.io/tilemill) +* [MapProxy](https://mapproxy.org) +* [QGIS](https://www.qgistutorials.com/en/docs/creating_basemaps_with_qtiles.html) +* [tippecanoe](https://github.com/mapbox/tippecanoe) + +For this exercise, you will publish a vector dataset of the [greater hyderabad municipal corporation ward boundaries](https://livingatlas-dcdev.opendata.arcgis.com/datasets/a090c89d52f1498f96a82e97b8bfb83e_0/about), from the location below: + +* data: `workshop/exercises/data/greater_hyderabad_municipal_corporation_ward_Boundaries.geojson` Let's generate the tiles as the first step using tippecanoe: @@ -48,7 +48,7 @@ Let's generate the tiles as the first step using tippecanoe: ```bash cd workshop/exercises docker run -it --rm -v ${PWD}/data:/data emotionalcities/tippecanoe \ -tippecanoe --output-to-directory=/data/tiles/ --force --maximum-zoom=16 --drop-densest-as-needed --extend-zooms-if-still-dropping --no-tile-compression /data/cycle-lanes-firenze.geojson +tippecanoe --output-to-directory=/data/tiles/ --force --maximum-zoom=16 --drop-densest-as-needed --extend-zooms-if-still-dropping --no-tile-compression /data/greater_hyderabad_municipal_corporation_ward_Boundaries.geojson ``` @@ -56,56 +56,127 @@ tippecanoe --output-to-directory=/data/tiles/ --force --maximum-zoom=16 --drop-d Open the pygeoapi configuration in a text editor. Add a new dataset section as follows: - ``` {.yaml linenums="1"} - Cycle: - type: collection - title: Cycle Circulation Area in Florence - description: Cycle lanes and other cycle paths in the city of Florence. - keywords: - - cycle - links: - - type: text/html - rel: canonical - title: information - href: http://opendata.comune.firenze.it/?q=metarepo/datasetinfo&id=52d8d3ab-eae5-400e-8561-d974f8612de0 - hreflang: en-US - extents: - spatial: - bbox: [-180,-90,180,90] - crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 - temporal: - begin: 2011-11-11 - end: null # or empty - providers: - - type: feature - name: GeoJSON - data: /data/cycle-lanes-firenze.geojson - #id_field: accicid - - type: tile - name: MVT - data: /data/tiles - #data: tests/data/tiles/DATASET - options: - metadata_format: tilejson # default | tilejson - bounds: [[11.1861935050234251,43.7512761718001855],[11.3125196304517655,43.8129406631082645]] - zoom: - min: 0 - max: 16 - schemes: - - WorldCRS84Quad - format: - name: pbf - mimetype: application/vnd.mapbox-vector-tile - ``` +``` {.yaml linenums="1"} + Hyderabad: + type: collection + title: Greater Hyderabad Municipal Corporation ward boundaries + description: The city ward boundaries represent the administrative and electoral boundary areas of the city. It plays a great role in planning of the city, for each council of the municipal corporation. + keywords: + - Boundaries + - Administrative + - Ward + links: + - type: text/html + rel: canonical + title: information + href: https://livingatlas-dcdev.opendata.arcgis.com/datasets/a090c89d52f1498f96a82e97b8bfb83e_0/about + hreflang: en-US + extents: + spatial: + bbox: [78.2379194985166180,17.2908061510471995,78.6217049083810764,17.5618443356918768] + crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 + temporal: + begin: 2011-11-11 + end: null # or empty + providers: + - type: feature + name: GeoJSON + data: /data/greater_hyderabad_municipal_corporation_ward_Boundaries.geojson + id_field: objectid + - type: tile + name: MVT + data: /data/tiles + options: + metadata_format: tilejson # default | tilejson + zoom: + min: 0 + max: 16 + schemes: + - WorldCRS84Quad + format: + name: pbf + mimetype: application/vnd.mapbox-vector-tile +``` Save the file and restart Docker Compose. Navigate to `http://localhost:5000/collections` to evaluate whether the new dataset has been published. -Additional check for the following tile specific endpoints in the `Cycle` collection: +Additional check for the following tile specific endpoints in the `Hyderabad` collection: + +- tile links in [http://localhost:5000/collections/hyderabad/tiles](http://localhost:5000/collections/hyderabad/tiles) +- tile metadata in [http://localhost:5000/collections/hyderabad/tiles/WorldCRS84Quad/metadata](http://localhost:5000/collections/hyderabad/tiles/WorldCRS84Quad/metadata) + +![TileSet](../assets/images/vtiles-hyderabad.png) -- tile links in [http://localhost:5000/collections/Cycle](http://localhost:5000/collections/Cycle) -- tile metadata in [http://localhost:5000/collections/Cycle/tiles/WorldCRS84Quad/metadata](http://localhost:5000/collections/Cycle/tiles/WorldCRS84Quad/metadata) +## Publish vector tiles from Elasticsearch + +Elasticsearch provides a middleware that [renders an index on the fly, as vector tiles](https://www.elastic.co/blog/introducing-elasticsearch-vector-tile-search-api-for-geospatial). This middleware is also supported by the pygeoapi mvt backend. + +If you want to explore publishing vector tiles using Elasticsearch clone this fork of pygeoapi: + +