-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
- Added fixes for the OGC API Tiles driver #7656
Conversation
- Passed uri to TileMatrixSet::parse - updated uris of well-known tile matrix sets
More fixes are needed to support OGC 2D Tile Matrix Set v2: cf #6882 |
Yes. I would like to address #6882 on a different PR. |
sounds good. Make sure to have commit hooks installed to have correct code formatting: cf https://gdal.org/development/dev_practices.html#commit-hooks |
frmts/ogcapi/gdalogcapidataset.cpp
Outdated
|
||
if (uri.empty()) | ||
{ | ||
CPLError(CE_Failure, CPLE_AppDefined, "Cannot parse TMS uri"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doublebyte1
Not sure what the logic is, but it is totally OK for a 2D TMS to not have a URI, so this should probably not fail here?
Only registered 2DTMS have a uri
.
Also, I would also expect the URI-matching-based identification (for registered 2DTMSs) to have happened before using the tileMatrixSetURI
property of the tileset instead. If the tileMatrixSetURI
was a match for a registered 2DTMS, the client would not need to download the 2DTMS definition at all (the DownloadJSon()
call above I think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerstlouis you are right. There are other ways of parsing the TMS information.
I will need to refactor the code, to send the entire document (as before) and to parse the uri at the beginning of the parse function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doublebyte1 Yes essentially it could use the URI already checked at:
https://github.com/OSGeo/gdal/blob/master/frmts/ogcapi/gdalogcapidataset.cpp#L1489
const auto oTileMatrixSetURI = oTileset.GetString("tileMatrixSetURI");
and if this URI is predefined (e.g., WebMercatorQuad or WorldCRS84Quad), then it does not need to call DownloadJSon(osTilingSchemeURL.c_str(), ...
.
This InitWithTilesAPI()
method is very long though, so it would benefit from being split into different methods each performing one specific high level task.
… If that fails, instead of throwing an error it does what it was doing before (e.g.: sends an entire document to the parser and lets it find the needed information).
// Attempts to find the uri for a well-known TMS; if it does not work, it will send the entire document | ||
const auto uri = oDoc.GetRoot().GetString("uri"); | ||
|
||
auto tms = gdal::TileMatrixSet::parse( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerstlouis for the time being, I am just checking if it can get an uri, and if not it defaults to what was there before (e.g.: sending the entire document). At least this is now working for well-known uris.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doublebyte1 Yes it seems that this method accepts either an identifier or a full document, which is quite confusing.
Ideally, there would be a diferent method gdal::TileMatrixSet::fromIdentifier()
and parse()
would always expect a TileMatrixSet definition.
Then, parse()
itself could be the one first looking for the uri
inside of the definition and then calling gdal::TileMatrixSet::fromIdentifier()
when it is found.
But what I was saying earlier, is that when parsing the tileset, it is oTileMatrixSetURI
(in the tileset metadata, not the tile matrix set definition) that should be used with gdal::TileMatrixSet::fromIdentifier()
(or parse()
) before downloading the TileMatrixSet definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerstlouis I got that, but I don't want to address this refactoring in this PR.
Co-authored-by: Even Rouault <even.rouault@spatialys.com>
The OGC API Tiles dataset was not working as expected.
A complete document was being passed to TileMatrixSet::parse, which was causing a series of issues:
The well-known URI was being compared to a word/name, rather than an uri. I added support to two of the most popular ones, but we could add more.
Submitted changes:
With these changes, I can read raster and vector tiles from these urls:
gdalinfo -oo API=TILES --config CPL_DEBUG ON "OGCAPI:https://maps.gnosis.earth/ogcapi/collections/blueMarble"
ogrinfo -oo API=TILES --config CPL_DEBUG ON "OGCAPI:https://maps.gnosis.earth/ogcapi/collections/Daraa"