-
Notifications
You must be signed in to change notification settings - Fork 210
Description
So an issue I've known would be coming my way is in the use of CRS_to_uri inside the WMTSCapabilities.xml endpoints for the bounds object CRS parameter, which when using a slightly tweaked/custom CRS can result in a None being specified in the WMTS XML document. This causes issues with clients like QGIS, but will work as soon as a valid CRS URI (or interestingly WKT) is swapped in.
After looking at this, I think I must conclude that this isn't a bug in pyproj/rasterio/rio-tiler. It is totally possible to define a tilematrixset or COG that uses a CRS that may use a geographic CRS that won't resolve with to_authority despite only minor modifications.
Lowering the confidence parameter used in rio-tiler could help in some cases but won't work universally and could cause some other unintended issues. So it made the most sense to open an issue here and discuss solutions.
I think then there are 2/3 options
- raise an error when
CRS_to_urievals toNone - raise a warning in the logs when this occurs and continue to allow
Noneto pass through - Fall back to the WKT
After reviewing OGC 06-121r9 (sections 10.2-10.3) it does look like for the most part clients would be expecting this CRS parameter to be a URI/URN. However, while testing I was able to use the full WKT string for the crs parameter and QGIS/GDAL was able to use it correctly. Given the ubiquity of GDAL, my expectation would be that this could be seen as a sensible fall back even if it's technically out-of-spec with the OGC, although maybe this is just plainly a bad idea...
My suspicion then is that option 1 would also be too aggressive of a fix and that it might just be best to keep the change in behavior minimal by logging a warning.
I am happy to implement this, but wanted to check with others before starting to see if there are other ideas or ways to work with the WMTS spec in ways I hadn't considered