WMTS Layer not visible in WPF-Application with ArcgisRuntime 100.11

287
0
05-27-2021 10:37 PM
ERDMANN-Softwaregesellschaft
New Contributor

Hello,

i have a problem to show any layer from geo.admin.ch. I've tried several things but i get it not to work. I have added a base layer from ArcGIS-Online for orientation. For testing i have created an empty WPF-Project.

Here is a small sample code (only xaml) how i test it:

 

<Window x:Class="GIS_WMTS.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
        xmlns:local="clr-namespace:GIS_WMTS"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <esri:MapView x:Name="mapView" Loaded="MapView_Loaded">

            <esri:Map x:Name="map">

                <esri:Map.Basemap>
                    <esri:Basemap>
                        <esri:ArcGISTiledLayer Source="https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer" />
                    </esri:Basemap>
                </esri:Map.Basemap>
                <esri:WmtsLayer Source="https://wmts.geo.admin.ch/EPSG/3857/1.0.0/WMTSCapabilities.xml" 
                                LayerId="ch.astra.ivs-gelaendekarte"></esri:WmtsLayer>

            </esri:Map>

        </esri:MapView>
    </Grid>
</Window>

 

 

I tried also from code behind:

 

Map map = new Map();
			ArcGISTiledLayer tl = new ArcGISTiledLayer(new Uri("https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"));
			map.Basemap = new Basemap(tl);

			WmtsService wmts = new WmtsService(new Uri("https://wmts.geo.admin.ch/EPSG/3857/1.0.0/WMTSCapabilities.xml"));
			await wmts.LoadAsync();

			var firstLayerInfo = wmts.ServiceInfo.LayerInfos.FirstOrDefault(x => x.Id == "ch.astra.ivs-gelaendekarte");
			WmtsLayer wmtsLayer = new WmtsLayer(firstLayerInfo);

			map.OperationalLayers.Add(wmtsLayer);

			this.mapView.Map = map;

 

 

I don't know whats going wrong. I hope someone can give me a hint. Maybe it is not possible to use layers from this site.

 

kind regards

Heiko Steinfeld

0 Kudos
0 Replies