I have a problem with a specific WMTS provider when trying to upgrade from v10 to v14. I am currently at the latest production release. This provider, Planet, requires us to provide an api key and some other data (date range, color visualization) with each image request. In our version 10 application we are overriding OnSendingWebRequest and modifying the RequestUri to add these things. It works perfectly.
On attempting to upgrade to the WmtsAsyncLayer I see that OnSendingWebRequest is gone and in its place is OnSendingHttpRequestMessage. The argument is a little different but buried inside I still find a RequestUri that I can modify as needed. I don’t think that is where our current problem lies.
What appears to be happening is that the RequestUri provided in the argument of OnSendingHttpRequestMessage is not the same as what is provided in the old OnSendingWebRequest. For example, when a request is made for an image in version 10, the AbsoluteUri looks like this:
The server does not understand this request and we get the following error:
The HTTP request failed with status code: Not Found
The correct request format is found in the GetCapabilities document, but I don’t think it is being read the same way in version 14 as it was in version 10. With Planet Data you don’t use the base Uri for subsequent requests, only for GetCapabilities.
Maybe you can make some sense out of this without a sample project. The problem is that accessing the Planet data requires a proprietary api key which I cannot easily provide.
It seems the request we sent in v10 is an XYZ request while the one in v14 is a standard WMTS:
/wmts/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png
Fix the WMTS request:
The following string in the WMTS Uri seems suspicious,
Latest%20PS%20sen2%20Normalized%20Analytic%20monthly%20subscription
it’s supposed to be the layer name but now it looks like the layer description, can you:
Find out the correct name of the layer you want to display. You can do wmtsLayer.GetServerLayerNames() to get the list of layer names.
Do wmtsLayer.ActiveLayerName = “activeLayerName” to set the active layer name
FYI, you can set ActiveStyleName and TileMatrixSetName as well, which will also be embedded in the wmts request
Note: We are thinking of renaming the LayerName to LayerId to make it less confusing.
About the legacy XYZ request
An wmts layer should not send out an xyz request like …/latest-series/473b9b21-5940-45c8-9729-c765619eda4d/gmap/10/250/422.png, I’m wondering how you get this xyz request template? It’s not from the wmts GetCapabilities, right? Did you customize your wmtslayer in v10 to send this request?
If you want to keep using the XYZ service (instead of Wmts), you can create a custom XYZ layer, which’s really straightforward. Here is the source code of OpenStreetMapAsyncLayer, as an example, for your reference. OpenStreetMapAsyncLayer.cs (3.9 KB)
The correct request template is in the GetCapabilities document that goes with this WMTS service. The document clearly identifies this as a WMTS service. We are not generating the request string, only adding the api_key and the color scheme indicator. I have attached the entire GetCapabilities document so you can see what I mean. I believe the version 10 WMTS layer was using this GetCapabilities document differently than the version 14 WMTS layer. Please have a look and see what you think.