We want to support the following WMTS layer in the map.
With the old SDK (SDK 10.2.7), this worked. After the upgrade to 200.8, it's not working.
We changed the code to load the WmtsService first and get the layer info and then use it to create the WmtsLayer. Few other WMTS layers are working successfully after the upgrade. However we had no luck with the above LINZ WMTS layer. Can you please help?
Hi,
Your WMTS service has 2 Tile Matrix sets with different spatial references: 3857 and 2193. I have succeeded to view your WMTS service with wkid = 2193. I have modified Esri samples code which have Esri.ArcGISRuntime.WPF 300.0.0 package. I think it must work and with 200.8.0.
Code below:
// Define the Uri to the WMTS service.
Uri wmtsUri = new Uri("https://data.linz.govt.nz/services;key=5169bef47e224d43a935e4283e2d57a6/wmts/1.0.0/set/4769/WMTSCapabilities.xml");
// Define a new instance of the WMTS service.
WmtsService myWmtsService = new WmtsService(wmtsUri);
// 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, and select the one with the desired Id value.
WmtsLayerInfo info = myWmtsServiceInfo.LayerInfos.Single(l => l.Id == "set-4769");
Map myMap = new Map(SpatialReference.Create(2193));
// Create an instance for the WMTS layer.
WmtsLayer myWmtsLayer;
// Inspect your layer info matrix names
var matrixSet = info.TileMatrixSets.FirstOrDefault(cms => cms.SpatialReference.Wkid == 2193);
if (matrixSet != null)
{
myWmtsLayer = new WmtsLayer(info, matrixSet);
}
else
{
myWmtsLayer = new WmtsLayer(info);
}
var newBasemap = new Basemap();
newBasemap.BaseLayers.Add(myWmtsLayer);
myMap.Basemap = newBasemap;
// Assign the map to the MapView.
MyMapView.Map = myMap;
// Zoom the MapView to the geographic boundaries of the WMTS data
if (myWmtsLayer.FullExtent != null)
{
await MyMapView.SetViewpointAsync(new Viewpoint(myWmtsLayer.FullExtent));
}
Thank you for your reply. Your code worked for me as well.
However, I'm trying to get this WMTS layer applied on top of another basemap layer which has the spatial reference: 3857. So it's important to get the Tile Matrix set with spatial references: 3857 working.
I think, it is probably a bug because when you create a WMTS layer from 3857 tile matrix set, FullExtent property of created layer still shows coordinates in 2193 wkid. I have tried to project FullExtent to 3857 wkid and then call SetViewpointAsync with projected extent, but it doesn't help.
Make a try to create case in Esri support page or call your local distributors to do that.