Hello,there.Sorry about my poor english.
I am adding a wmtslayer by using the following code.
But there is a exception occurs while WmtsService loading.
The Exception says:Invalid XML.: Parser couldn't move inside Keywords.
Here's the call stack:
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
在 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
在 ArcGISRuntime.WPF.Samples.WMTSLayer.WMTSLayer.<Button2_Click>d__2.MoveNext() 位置 C:\Workbench\sources\arcgis-runtime-samples-dotnet-master\src\WPF\ArcGISRuntime.WPF.Viewer\Samples\Layers\WMTSLayer\WMTSLayer.xaml.cs:行号 72
Any idea why this exception happens?
You can find the capacities xml from attachment.
try
{
// Define the Uri to the WMTS service
var myUri = new Uri("http://xxxxx:8080/geoserver/gwc/service/wmts");
// Define a new instance of the WMTS service
WmtsService myWmtsService = new WmtsService(myUri);
// Load the WMTS service
await myWmtsService.LoadAsync();
// Get the service information (i.e. metadata) about the WMTS service
WmtsServiceInfo myWMTSServiceInfo = myWmtsService.ServiceInfo;
// Obtain the read only list of WMTS layer info objects
IReadOnlyList<WmtsLayerInfo> myWmtsLayerInfos = myWMTSServiceInfo.LayerInfos;
// Create a new instance of a WMTS layer using the first item in the read only list of WMTS layer info objects
WmtsLayer myWmtsLayer = new WmtsLayer(myWmtsLayerInfos[0]);
// Create a new map
Map myMap = new Map();
// Get the basemap from the map
Basemap myBasemap = myMap.Basemap;
// Get the layer collection for the base layers
LayerCollection myLayerCollection = myBasemap.BaseLayers;
// Add the WMTS layer to the layer collection of the map
myLayerCollection.Add(myWmtsLayer);
// Assign the map to the MapView
MyMapView.Map = myMap;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Thank you!
I'm having the same problem as you. Did you achieve to solve it?
Thanks
Karl Barkmann — We have identified several compatibility problems between ArcGIS Runtime and newer GeoServer versions. Looks like the service you are using is affected by the same issues. You can find detailed technical discussion and some workaround ideas here: Geoserver 2.14 with ArcgisRuntimeSDK 100.4
We've prepared several GeoServer compatibility improvements and they will be available in a Runtime update in the near future. I will update this discussion when it's released.
Good news — ArcGIS Runtime 100.5.0 was released this week! It makes several improvements to GeoServer/GWC compatibility. Upgrading to this version should resolve the WMTS problems that you are experiencing. Please let us know how it goes!