I’m looking to find a way to add the WMTS version of my configuration to Leaflet.
I’ve found instructions on how to integrate a sentinel-hub configuration into Leaflet using the Playground. However, the Playground provides an example code for a Leaflet map that uses the WMS version.
Is there any way to get an example of a Leaflet map utilizing the WMTS version?
For basic usecases the code looks pretty similar to the one for WMS that you already found.
You will need to extend the WMTS class if you want to use any of the custom params for a more complex usecase (custom params are listed here - some of them, like downsampling and upsampling, can be set in the layers in the dashboard though).
However, I needed to update the code to make it work with the sentinel hub WMTS server:
Originally, the L.TileLayer.WMTS object that this package creates structured the GetTile request URL with both the tilematrixSet and tilematrix values combined with a colon, and passed into the tilematrix parameter - ie. &tilematrix=PopularWebMercator512:7. This URL construction needed be updated to separate these values - ie. &tilematrix=7&tilematrixSet=PopularWebMercator512
The WMTS layer used as a reference in this object had 22 values in its matrix, which were zero based vs. the 20 values in the sentinel configuration which were 1-based. This required updating the getDefaultMatrix function to produce the correct matrix