diff --git a/workshop/content/docs/assets/images/map_3395.png b/workshop/content/docs/assets/images/map_3395.png new file mode 100644 index 00000000..7b72fd3d Binary files /dev/null and b/workshop/content/docs/assets/images/map_3395.png differ diff --git a/workshop/content/docs/assets/images/map_3857.png b/workshop/content/docs/assets/images/map_3857.png new file mode 100644 index 00000000..01da8524 Binary files /dev/null and b/workshop/content/docs/assets/images/map_3857.png differ diff --git a/workshop/content/docs/assets/images/map_4326.png b/workshop/content/docs/assets/images/map_4326.png new file mode 100644 index 00000000..bfa67ab0 Binary files /dev/null and b/workshop/content/docs/assets/images/map_4326.png differ diff --git a/workshop/content/docs/assets/images/map_bbox.png b/workshop/content/docs/assets/images/map_bbox.png new file mode 100644 index 00000000..fba1bc96 Binary files /dev/null and b/workshop/content/docs/assets/images/map_bbox.png differ diff --git a/workshop/content/docs/assets/images/map_bbox_canada.png b/workshop/content/docs/assets/images/map_bbox_canada.png new file mode 100644 index 00000000..7066a6c2 Binary files /dev/null and b/workshop/content/docs/assets/images/map_bbox_canada.png differ diff --git a/workshop/content/docs/assets/images/map_square.png b/workshop/content/docs/assets/images/map_square.png new file mode 100644 index 00000000..8da50a50 Binary files /dev/null and b/workshop/content/docs/assets/images/map_square.png differ diff --git a/workshop/content/docs/assets/images/oam1.png b/workshop/content/docs/assets/images/oam1.png new file mode 100644 index 00000000..9e19a6c3 Binary files /dev/null and b/workshop/content/docs/assets/images/oam1.png differ diff --git a/workshop/content/docs/assets/images/oam2.png b/workshop/content/docs/assets/images/oam2.png new file mode 100644 index 00000000..6a1d00a4 Binary files /dev/null and b/workshop/content/docs/assets/images/oam2.png differ diff --git a/workshop/content/docs/assets/images/vector-tiles-styles.png b/workshop/content/docs/assets/images/vector-tiles-styles.png new file mode 100644 index 00000000..1d5073ed Binary files /dev/null and b/workshop/content/docs/assets/images/vector-tiles-styles.png differ diff --git a/workshop/content/docs/publishing/ogcapi-maps.md b/workshop/content/docs/publishing/ogcapi-maps.md index 450ae830..139849aa 100644 --- a/workshop/content/docs/publishing/ogcapi-maps.md +++ b/workshop/content/docs/publishing/ogcapi-maps.md @@ -7,7 +7,17 @@ title: Exercise 4 - Maps of geospatial data via OGC API - Maps [OGC API - Maps](https://ogcapi.ogc.org/maps) provides a Web API to access any geospatial data as a georeferenced map image. -* [OGC API - Maps](https://docs.ogc.org/DRAFTS/20-058.html) +* [OGC API - Maps](https://docs.ogc.org/is/20-058/20-058.html) + +Here are a few things that a client can request from a OGC API - Maps server: + +* Request a visual representation of one or more geospatial data layers in different styles; +* Select by area, time and resolution of interest; +* Change parameters such as the width, height and coordinate reference systems. + +!!! note + + While OGC API - Maps is great for providing dynamic maps on the Web, if your data has can be based on a set tiling scheme, and the resulting maps do not need to be dynamically generated, [OGC API - Tiles](./ogcapi-tiles.md) provides a suitable approach to serve efficiently using less server resources. ## pygeoapi support @@ -17,7 +27,7 @@ pygeoapi supports the OGC API - Maps specification, using [MapServer MapScript]( See [the official documentation](https://docs.pygeoapi.io/en/latest/publishing/ogcapi-maps.html) for more information on supported map backends -## Publish a raster dataset +## Publish a vector dataset In this section we'll be exposing a Geopackage file available at `workshop/exercises/data/airport.gpkg` location using [MapServer MapScript](https://www.mapserver.org/mapscript). This data can be consumed with various clients which are compliant with OGC APIs - Maps. List of few such clients can be found [here](https://github.com/opengeospatial/ogcapi-maps/blob/master/implementations.adoc#clients). Here we can also pass style in *.sld* format. Which can be generated on [Geoserver](https://docs.geoserver.org/stable/en/user/styling/index.html), [QGIS](https://www.qgistutorials.com/en/docs/3/basic_vector_styling.html), etc. @@ -66,15 +76,54 @@ In this section we'll be exposing a Geopackage file available at `workshop/exerc table: airport ``` -!!! note +After the server has started you can access the collection page here: - See [the official documentation](https://docs.pygeoapi.io/en/latest/publishing/ogcapi-maps.html) for more information on supported map backends +http://localhost:5000/collections/airports + +And the map here: + +http://localhost:5000/collections/airports/map?f=png + +![](../assets/images/map_4326.png){ width=50% } !!! note The airport data is published as **both** a map and a feature collection through a single endpoint (`/collections/airports`). How is this made possible in the above configuration? -## pygeoapi as a WMS proxy +The map comes with the default CRS84 CRS, but you can easily change it with the `crs` parameter: + +http://localhost:5000/collections/airports/map?f=png&crs=EPSG:3857 + +You can also adjust other parameters (such as bounding box (`bbox`), bounding box CRS (`bbox-crs`), as well as `width` and `height` to create custom maps: + +http://localhost:5000/collections/airports/map?f=png&bbox-crs=OGC:CRS84&bbox=-142,42,-52,84 + +![](../assets/images/map_bbox.png){ width=50% } + +http://localhost:5000/collections/airports/map?f=png&width=400&height=400 + +![](../assets/images/map_square.png){ width=50% } + + +!!! note + + See the [OGC API - Maps Standard](https://docs.ogc.org/is/20-058/20-058.html) for more details about the map parameters. + +!!! note + + OGC API - Maps supports CRS from Compact URIs (CURIEs, i.e. `EPSG:4326`, `CRS84`), safe CURIEs (e.g.: `[EPSG:4326]`, `[CRS84]`) and URIs: + + + + + + | ![map](../assets/images/map_4326.png) | ![map](../assets/images/map_3857.png) | ![map](../assets/images/map_3395.png) | + |:---:|:---:|:---:| + | EPSG:4326 | EPSG:3857 | EPSG:3395 | + + You can read more about the different ways of expressing CRSs on the maps section of the [pygeoapi documentation](https://docs.pygeoapi.io/en/latest/publishing/ogcapi-maps.html). + +## OPTIONAL: pygeoapi as a WMS proxy You can check the "pygeoapi as a Bridge to Other Services" section to learn how to [publish WMS as OGC API - Maps](../advanced/bridges.md#publishing-wms-as-ogc-api-maps). @@ -90,9 +139,14 @@ QGIS added support for API's providing rendered image layers via its raster supp - Open the `Add raster layer panel`. - Select `OGCAPI` for Source type. - Add the local endpoint as source `http://localhost:5000/collections/airports`. - - Select `PNG` as image format. + - Select `MAP` as API. - Finally add the layer to the map. + + ![](../assets/images/oam1.png){ width=50% } + + ![](../assets/images/oam2.png){ width=50% } + ### OWSLib [OWSLib](https://owslib.readthedocs.io) is a Python library to interact with OGC Web Services and supports a number of OGC APIs including OGC API - Maps. diff --git a/workshop/content/docs/publishing/ogcapi-tiles.md b/workshop/content/docs/publishing/ogcapi-tiles.md index 7e095327..ffec1bca 100644 --- a/workshop/content/docs/publishing/ogcapi-tiles.md +++ b/workshop/content/docs/publishing/ogcapi-tiles.md @@ -29,7 +29,7 @@ pygeoapi supports the core OGC API - Tiles specification, and is able to adverti !!! note - pygeoapi currently supports two well known Tile Matrix Sets: `WorldCRS84Quad` and `WebMercatorQuad`. Their definition is published on the [/TileMatrixSets](https://demo.pygeoapi.io/master/TileMatrixSets) end point. + By default, pygeoapi supports two well known Tile Matrix Sets: `WorldCRS84Quad` and `WebMercatorQuad`. Their definition is published on the [/TileMatrixSets](https://demo.pygeoapi.io/master/TileMatrixSets) end point. For additional TMS support, please check the [pygeoapi documentation](https://docs.pygeoapi.io/en/latest/publishing/ogcapi-tiles.html#providing-custom-tile-matrix-set-definitions). ## Publish pre-rendered vector tiles @@ -60,7 +60,7 @@ Let's generate the tiles as the first step using tippecanoe: ``` !!! note - Please note that the tippecanoe tool requires the input file to be in WGS84, and it always outputs tiles in WebMercator. + Please note that the tippecanoe tool requires the input file to be in `WGS84`, and **always** outputs tiles in `WebMercator`. !!! question "Update the pygeoapi configuration" @@ -268,6 +268,10 @@ QGIS supports OGC API Vector Tiles via the [Vector Tiles Layer](https://docs.qgi ![](../assets/images/qgis-vtiles-hyderabad3.png){ width=100% } + Note that with vector tiles, you can render styles according to attributes. To try it, load the styles file on `exercises/data/hyderabad/style-vector.qml`. + + ![](../assets/images/vector-tiles-styles.png){ width=100% } + ### LeafletJS [LeafletJS](https://leafletjs.com) is a popular JavaScript library to add interactive maps to websites. LeafletJS does not support OGC API's explicitly, however can interact with OGC API by using the results of the API directly. diff --git a/workshop/content/docs/standards.md b/workshop/content/docs/standards.md index a5004061..f3532091 100644 --- a/workshop/content/docs/standards.md +++ b/workshop/content/docs/standards.md @@ -82,14 +82,18 @@ functionality to users, as well as software implementation. pygeoapi implements numerous OGC API standards and draft standards. In addition, it is compliance certified and even a Reference Implementation (RI) for some of them. Compliance certification is important to remove interoperability risks. RI are always compliance certified. From OGC [Compliance Testing Program Policies & Procedures 08-134r11](https://docs.ogc.org/pol/08-134r11.html#toc26): -!!! [Citation](https://docs.ogc.org/pol/08-134r11.html#toc17) +!!! Citation + + Candidate Products that pass all the tests in a Compliance Test Package, and that OGC has reviewed and certified as having passed those tests, are considered compliant with that Implementation Standard version. - Candidate Products that pass all the tests in a Compliance Test Package, and that OGC has reviewed and certified as having passed those tests, are considered compliant with that Implementation Standard version. + Source: -!!! [Citation](https://docs.ogc.org/pol/08-134r11.html#term-reference-implementation-_ri_) +!!! Citation A Reference Implementation is a fully functional, licensed copy of a tested, branded software that has passes the test for an associated conformance class in a version of an Implementation Standard and that is free and publicly available for testing via a web service or download. + Source: + | Standard | pygeoapi status | Included in this workshop | |----------------------------------------|--------------------------|---------------------------| diff --git a/workshop/exercises/data/hyderabad/style-vector.qml b/workshop/exercises/data/hyderabad/style-vector.qml new file mode 100644 index 00000000..967b86fa --- /dev/null +++ b/workshop/exercises/data/hyderabad/style-vector.qml @@ -0,0 +1,196 @@ + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + 0 + 1 +