Hallo Ben,
when I try to use an another WMTS Layer with your code, an error occurs:
System.ApplicationException: “There are 0 matrix sets in this WMTS Server, but EU_EPSG_25832_TOPPLUS is not one of them. Please check WebBasedLayer.TileMatrixSetName property”
private async void WmtsTopPlusOpen_Click(object sender, RoutedEventArgs e)
{
var layerOverlay = new WmtsOverlay(new Uri(“https://sgx.geodatenzentrum.de/wmts_topplus_open”));
layerOverlay.ActiveLayerName = “web”;
layerOverlay.ActiveStyleName = “default”;
layerOverlay.TileMatrixSetName = “EU_EPSG_25832_TOPPLUS”;
layerOverlay.OutputFormat = “image/png”;
// provide a tileId to the cache otherwise a new cache folder will be created every time.
layerOverlay.TileCache = new FileRasterTileCache(“C:\_temp\layerOverlay2”, “tileId”);
mapView.Overlays.Add(layerOverlay);
mapView.MapUnit = GeographyUnit.Meter;
await layerOverlay.OpenAsync();
// The following 2 lines fetch the scales from the server, and apply those scales to the MapView
// Otherwise, the map will use the default scale collection (with 20 zooms)
var scales = layerOverlay.TileMatrixSet.Matrices.Select(m => m.Scale);
mapView.ZoomScales = new Collection<double>(scales.ToList());
// Set the initial extent and scale
mapView.CenterPoint = layerOverlay.GetBoundingBox().GetCenterPoint();
mapView.CurrentScale = mapView.ZoomScales[1];
await mapView.RefreshAsync();
}
What’s my mistake?
Regards Torsten