Hey @G_Vandenboom,
Yes, I am able to see the WMTS now. I was able to get it working on my side in a sample application. I had to intercept the SendingWebRequest event and flip the TileRow and TileCol values because they are expecting Z/Y/X instead of the usual Z/X/Y pattern. I also had to make sure to the set the TileSizeMode to Small to ensure it processes 256x256 tiles. Here’s the code:
private void MapView_Loaded(object sender, RoutedEventArgs e)
{
// Set the map's unit of measurement to meters(Spherical Mercator)
mapView.MapUnit = GeographyUnit.Meter;
WmtsTiledOverlay wmtsOverlay = new WmtsTiledOverlay(new []{new Uri(@"https://tiles1.geoserve.eu/Mosaics/tileserver/20220831_20220716_SV_RD_8bit_RGBMosaic_50cm_Nederland/wmts")},WmtsSeverEncodingType.Kvp);
wmtsOverlay.TileSizeMode = TileSizeMode.Small;
wmtsOverlay.ActiveLayerName = "20220831_20220716_SV_RD_8bit_RGBMosaic_50cm_Nederland";
wmtsOverlay.ActiveStyleName = "default";
wmtsOverlay.TileMatrixSetName = "GoogleMapsCompatible";
wmtsOverlay.OutputFormat = "image/jpg";
wmtsOverlay.TileCache = new FileRasterTileCache(@"C:\temp\wmtsOverlay");
wmtsOverlay.SendingWebRequest += WmtsOverlayOnSendingWebRequest;
mapView.Overlays.Add(wmtsOverlay);
// Set the map extent
wmtsOverlay.Open();
mapView.CurrentExtent = wmtsOverlay.GetBoundingBox();
}
private void WmtsOverlayOnSendingWebRequest(object sender, SendingWebRequestEventArgs e)
{
string originalQueryString = e.WebRequest.RequestUri.Query;
if (originalQueryString.Contains("GetTile"))
{
// Flip the TileRow and TileCol values
var arguments = originalQueryString
.Substring(1) // Remove '?'
.Split('&')
.Select(q => q.Split('='))
.ToDictionary(q => q.FirstOrDefault(), q => q.Skip(1).FirstOrDefault());
var row = arguments["TileRow"];
var column = arguments["TileCol"];
var uri = e.WebRequest.RequestUri.AbsoluteUri.Replace($"TileRow={row}", $"TileRow={column}").Replace($"TileCol={column}", $"TileCol={row}");
e.WebRequest = WebRequest.Create(uri);
}
}
Thanks,
Kyle