Skip to content
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

Give support to an OGC API Tiles layer #50296

Open
doublebyte1 opened this issue Sep 22, 2022 · 27 comments
Open

Give support to an OGC API Tiles layer #50296

doublebyte1 opened this issue Sep 22, 2022 · 27 comments
Labels
Data Provider Related to specific vector, raster or mesh data providers Feature Request

Comments

@doublebyte1
Copy link
Contributor

doublebyte1 commented Sep 22, 2022

Feature description

With the publication of part 1 of OGC API - Tiles, it would be great if QGIS would support adding layers published using this standard.

The idea would be to allow users to use the browser panel or the layer menu, to connect to a conformant server, and pull OGC API Tiles layers. OGC API Tiles supports vector, map and coverage tiles, but I think that it would be easier to start with vector tiles.

Additional context

If the community thinks this useful, I could start working on a PR.

@agiudiceandrea agiudiceandrea added the Data Provider Related to specific vector, raster or mesh data providers label Sep 23, 2022
@jerstlouis
Copy link

jerstlouis commented Nov 23, 2022

@doublebyte1 This was already working when we tested in 2021 during the Modular OGC API Workflows project using the GDAL OGC API driver which is available in GDAL 3.2+. Maps, Coverages, Tiles (including Map tiles, Coverages tiles, Vector tiles) were all working well. (NOTE: Even though the ogcapi GDAL driver is classified as raster, it also supports vector tiles. There is a comment saying that it could perhaps eventually also be merged with the oapif OGC API - Features driver).

From the menu bar, you select Layer > Add Layer > Vector (for vector tiles) or Raster (for Maps / Coverage (Tiles)) ; keep File radio button selected, and for Vector dataset prefix the URL to either the landing page or an individual collection by OGCAPI:. This process should probably be made more intuitive / obvious and better documented.

Then you can select a preferred API, format, TileMatrixSet as per the opening options of the OGC API driver.

See (draft) demo video at https://www.dailymotion.com/video/x80xzex (password: ModularWorkflows) at ~18:30 timestamp.

It would be nice to experiment with this again at the Web Mapping Code sprint next week to make sure it still works as expected.

EDIT: Just tested, and this still works: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble
Not as much luck with OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa:AgricultureSrf ...

@tomkralidis
Copy link
Contributor

Given the above, we should also consider overall OGC API workflow in QGIS (Layer -> Add OGC API Layer?).

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Apr 12, 2023

I think that is a great idea. We could add a collection endpoint, and QGIS would give the option to render it in whichever OAPIs are available (pretty much what is implemented now).

@tomkralidis but maybe OGC API Records should stay out of this? What do you think?

@doublebyte1
Copy link
Contributor Author

@doublebyte1 This was already working when we tested in 2021 during the Modular OGC API Workflows project using the GDAL OGC API driver which is available in GDAL 3.2+. Maps, Coverages, Tiles (including Map tiles, Coverages tiles, Vector tiles) were all working well. (NOTE: Even though the ogcapi GDAL driver is classified as raster, it also supports vector tiles. There is a comment saying that it could perhaps eventually also be merged with the oapif OGC API - Features driver).

From the menu bar, you select Layer > Add Layer > Vector (for vector tiles) or Raster (for Maps / Coverage (Tiles)) ; keep File radio button selected, and for Vector dataset prefix the URL to either the landing page or an individual collection by OGCAPI:. This process should probably be made more intuitive / obvious and better documented.

Then you can select a preferred API, format, TileMatrixSet as per the opening options of the OGC API driver.

See (draft) demo video at https://www.dailymotion.com/video/x80xzex (password: ModularWorkflows) at ~18:30 timestamp.

It would be nice to experiment with this again at the Web Mapping Code sprint next week to make sure it still works as expected.

EDIT: Just tested, and this still works: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble Not as much luck with OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa:AgricultureSrf ...

@jerstlouis I suppose this is the matching (not 100% clear from the documentation of the driver):

  • MAPS - OGC API Maps
  • TILES - OGC API Vector tiles- could it also be other tiles (e.g.: map, raster)?
  • COVERAGE - OGC API Coverages
  • ITEMS - OGC API Features?

@jerstlouis
Copy link

jerstlouis commented Apr 12, 2023

@doublebyte1 Yes, correct, that is the mapping of the resources / access mechanisms to the OGC API Standards.

As you say, Tiles is not only for Vector Tiles, but also for Coverage Tiles and Map Tiles.

Note that one of the first things that should be fixed is this issue about supporting 2DTMS 2.0 in GDAL:

OSGeo/gdal#6882

which really should not be too difficult, so a good thing to tackle at this upcoming code sprint.
Happy to provide additional 2DTMS guidance to anyone working on this.

@doublebyte1
Copy link
Contributor Author

@jerstlouis that sounds good. I have tested it and it works for:

  • OGC API Features, OGC API Coverages
    It did not work for OGC API Tiles (probably because of the issue you mentioned), but I could not get it to work with OGC API Maps, either.

@doublebyte1
Copy link
Contributor Author

I created a new issue here: #52674

@jerstlouis
Copy link

jerstlouis commented Apr 13, 2023

@doublebyte1 I just tested and OGC API - Maps does work here on my end in QGIS 3.28.3-Firenze with our end-points.

If you select Layer menu, Add Raster Layer, leave File radio button selected, then OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble and select MAP as the API and JPEG as the image format.

qgis-OGCAPIMaps

Make sure your GDAL is 3.6 or later and includes this fix:

OSGeo/gdal@761f66c

for

OSGeo/gdal#6832

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Apr 21, 2023

I have GDAL 3.6.2, released 2023/01/02 but it does not work.

Unsupported Data Source: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble|option:API=MAP|option:IMAGE_FORMAT=JPEG is not a supported raster data source API MAP requested, but not available```

@agiudiceandrea
Copy link
Contributor

@doublebyte1 I can confirm that it works using either QGIS 3.28.4 with GDAL 3.6.2 or QGIS 3.28.5 with GDAL 3.6.3.

@doublebyte1
Copy link
Contributor Author

@agiudiceandrea Thank You! It seems to be a problem with the mac os package, which uses an older version of GDAL.

@doublebyte1
Copy link
Contributor Author

@jerstlouis I have submitted this to address some issues: OSGeo/gdal#7656
I'll have a look at OSGeo/gdal#6882, once this is merged.

@doublebyte1
Copy link
Contributor Author

@doublebyte1 This was already working when we tested in 2021 during the Modular OGC API Workflows project using the GDAL OGC API driver which is available in GDAL 3.2+. Maps, Coverages, Tiles (including Map tiles, Coverages tiles, Vector tiles) were all working well. (NOTE: Even though the ogcapi GDAL driver is classified as raster, it also supports vector tiles. There is a comment saying that it could perhaps eventually also be merged with the oapif OGC API - Features driver).

From the menu bar, you select Layer > Add Layer > Vector (for vector tiles) or Raster (for Maps / Coverage (Tiles)) ; keep File radio button selected, and for Vector dataset prefix the URL to either the landing page or an individual collection by OGCAPI:. This process should probably be made more intuitive / obvious and better documented.

Then you can select a preferred API, format, TileMatrixSet as per the opening options of the OGC API driver.

See (draft) demo video at https://www.dailymotion.com/video/x80xzex (password: ModularWorkflows) at ~18:30 timestamp.

It would be nice to experiment with this again at the Web Mapping Code sprint next week to make sure it still works as expected.

EDIT: Just tested, and this still works: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble Not as much luck with OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa:AgricultureSrf ...

This seems to be raster tiles, only? OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble.
For testing vector tiles I used this: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa

@agiudiceandrea
Copy link
Contributor

Thank You! It seems to be a problem with the mac os package, which uses an older version of GDAL.

@doublebyte1, so, was your previous comment:

I have GDAL 3.6.2, released 2023/01/02 but it does not work.
Unsupported Data Source: >OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble|option:API=MAP|option:IMAGE_FORMAT=JPEG is not a supported raster data source API MAP requested, but not available

incorrect about the GDAL version used?

@jerstlouis
Copy link

@doublebyte1 blueMarble provides raster tiles only (and the reason it was working when I tested that time was because it was using OGC API - Coverages).

OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa:AgricultureSrf provides vector tiles for a single layer, whereas
OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa provides multi-layer vector tiles, including the Agricultural Surfaces layer (both options should work).

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Apr 30, 2023

Thank You! It seems to be a problem with the mac os package, which uses an older version of GDAL.

@doublebyte1, so, was your previous comment:

I have GDAL 3.6.2, released 2023/01/02 but it does not work.
Unsupported Data Source: >OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble|option:API=MAP|option:IMAGE_FORMAT=JPEG is not a supported raster data source API MAP requested, but not available

incorrect about the GDAL version used?

@agiudiceandrea On my system, I am running gdal 3.62. I am running the current version of QGIS 3.30.

In linux, using the master version of QGIS and the master version of gdal (both compiled from source), everything works as expected.

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Apr 30, 2023

@doublebyte1 blueMarble provides raster tiles only (and the reason it was working when I tested that time was because it was using OGC API - Coverages).

OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa:AgricultureSrf provides vector tiles for a single layer, whereas OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa provides multi-layer vector tiles, including the Agricultural Surfaces layer (both options should work).

@jerstlouis With the fix I was able to load raster tiles in QGIS, but not vector tiles. Maybe because of the issue you described here: https://github.com/OSGeo/gdal/pull/7656/files/955d044b188ee338f923000a3bf161530cecb7a7#r1181229171

Screenshot from 2023-04-30 14-51-33

@doublebyte1
Copy link
Contributor Author

With this OSGeo/gdal#7656 , we can read OGC API (raster) tiles in QGIS, at least from WorldCRS84Quad. I will close this issue for now.

@doublebyte1
Copy link
Contributor Author

This appears to have stopped working again:

Screenshot 2023-12-11 at 20 18 21
2023-12-11T20:18:44     CRITICAL    Unsupported Data Source : OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble/tiles|option:API=TILES|option:TILEMATRIXSET=WorldCRS84Quad is not a supported raster data source
             Missing bbox

@doublebyte1 doublebyte1 reopened this Dec 11, 2023
doublebyte1 referenced this issue in opengeospatial/ogcapi-workshop Dec 11, 2023
* added client access example in tiles

* fixed minor issues

* Update tiles.md

---------

Co-authored-by: Tom Kralidis <tomkralidis@gmail.com>
@jerstlouis
Copy link

jerstlouis commented Dec 11, 2023

@doublebyte1 The supported end-point for GDAL / QGIS are either the landing page (ending here at /ogcapi) or the collection (ending at /blueMarble)

Does it work if you remove the /tiles part? (which is the list of map tilesets).

(unless new support for tileset lists end-points was added more recently to GDAL and I am not aware of it).

@doublebyte1
Copy link
Contributor Author

@doublebyte1 The supported end-point for GDAL / QGIS are either the landing page (ending here at /ogcapi) or the collection (ending at /blueMarble)

Does it work if you remove the /tiles part? (which is the list of map tilesets).

(unless new support for tileset lists end-points was added more recently to GDAL and I am not aware of it).

No, it doesn't.

Unsupported Data Source : OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble|option:API=TILES|option:TILEMATRIXSET=WorldCRS84Quad is not a supported raster data source
             API TILES requested, but not available

@doublebyte1
Copy link
Contributor Author

When opening the landing page, it does detect the layers, but then it does not manage to open any.

Screenshot 2023-12-12 at 10 06 41

@kudlav
Copy link

kudlav commented Jul 9, 2024

Hi, I'm testing the compatibility of QGIS with OGC API Tiles to access tiled data and I'm not very successful.

Loading by tileset description

not supported

Examples are from OpenLayers: raster, vector.

Loading from the landing page

  • Add Vector: Invalid Data Source: OGCAPI:https://maps.gnosis.earth/ogcapi is not a valid or recognized data source.

Loading from the collection description

  • Add Vector: Invalid Data Source: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa is not a valid or recognized data source.
  • Add Vector: Invalid Data Source: OGCAPI:https://maps.gnosis.earth/ogcapi/collections/NaturalEarth is not a valid or recognized data source.
  • Adding raster:
{
  "dataType": "map",
  "crs": "http://www.opengis.net/def/crs/EPSG/0/4326",
  "extent": {
    "spatial": {
      "bbox": [[-180, -90, 180, 90]]
    }
  },
  "links": [
    {
      "rel": "self",
      "type": "application/json",
      "href": "https://maps.gnosis.earth/ogcapi/collections/blueMarble?f=json"
    },
    {
      "rel": "http://www.opengis.net/def/rel/ogc/1.0/coverage",
      "type": "image/tiff; application=geotiff",
      "href": "https://maps.gnosis.earth/ogcapi/collections/blueMarble/coverage?f=tif"
    },
    {
      "rel": "http://www.opengis.net/def/rel/ogc/1.0/coverage-rangetype",
      "type": "application/json",
      "href": "https://maps.gnosis.earth/ogcapi/collections/blueMarble/coverage/rangetype?f=json"
    }
  ]
}

QGIS 3.38.0
Windows 11

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Jul 18, 2024

Status of the Add Layer (Raster and Vector) OGCAPI option using 3.39.0-Master 399f7df1c7 and GDAL3.10.0 dev-126a88523a:

  • OGC API - Maps ✅
  • OGC API - Coverages ✅
  • OGC API - Tiles (raster) ✅
  • OGC API - Tiles (vector) ❌ - see this issue
  • OGC API Features ❌ - see this issue

@doublebyte1
Copy link
Contributor Author

doublebyte1 commented Jul 18, 2024

Details to Reproduce the results on the previous comment

Please note that in order for GDAL to be able to resolve the relative links on the GNOSIS server the version should be >= OSGeo/gdal@b289928

OGC API - Maps

Screenshot from 2024-07-18 20-43-17

OGC API - Tiles (raster)

Screenshot from 2024-07-18 20-43-52

OGC API - Coverages

Screenshot from 2024-07-18 20-46-48
COVERAGES.

OGC API - Features

More details on this issue.

OGC API - Tiles (vector)

More details on this issue.

@kudlav
Copy link

kudlav commented Jul 19, 2024

Support of OGC API - Tiles (raster) is only partial as QGIS cannot load tileset from tileset description.

@jerstlouis
Copy link

jerstlouis commented Jul 19, 2024

@kudlav I don't think GDAL supports pointing it directly to a tileset end-point yet (e.g., https://maps.gnosis.earth/ogcapi/collections/Daraa/map/tiles/WebMercatorQuad). Perhaps we need to file an issue (feature request -- it's not a bug) for GDAL about this first?

An implementation can actually conform to OGC API - Tiles "Core" without even providing tileset metadata.

If we really want to be comprehensive, it should also be possible to open a tileset by providing a template using variables for level, row, column (e.g., https://maps.gnosis.earth/ogcapi/collections/Daraa/map/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol} plus the URI of a registered 2DTMS (e.g., https://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad) or a link or local 2DTMS 2.0 JSON definition (e.g., same link which can also return a JSON definition if following re-direction and using Accept: application/json request header, or somewhere else like https://raw.githubusercontent.com/opengeospatial/2D-Tile-Matrix-Set/master/registry/json/WebMercatorQuad.json).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data Provider Related to specific vector, raster or mesh data providers Feature Request
Projects
None yet
Development

No branches or pull requests

5 participants