Hello Esri Community,
I experience some issues while loading a AGSWMTSLayer on iOS devices. The only thing I see is a grid which shows a user's location. Since the production URL of the map that I use in my project is under NDA, I cannot post it publicly so I've found an equivalent one, which does not work but has the same structure. Here is the code:
#define wmtsURL @"https://www.orka-mv.de/geodienste/orkamv/wmts/1.0.0/WMTSCapabilities.xml" - (void)viewDidLoad { [super viewDidLoad]; self.mapView.layerDelegate = self; self.wmtsInfo = [[AGSWMTSInfo alloc] initWithURL: [NSURL URLWithString:wmtsURL]]; self.wmtsInfo.delegate = self; } - (void) wmtsInfoDidLoad:(AGSWMTSInfo *) wmtsInfo{ NSArray *layerInfos = [wmtsInfo layerInfos]; AGSWMTSLayerInfo *layerInfo = [layerInfos objectAtIndex:0]; self.wmtsLayer = [wmtsInfo wmtsLayerWithLayerInfo:layerInfo andSpatialReference:nil]; [self.mapView addMapLayer:self.wmtsLayer withName:@"wmts Layer"]; }
I've also made an equivalent code for Android and a map is loaded. However I still struggle with the iOS ArcGIS SDK. Does anyone experience the same issue?
Thanks in advance.
Hey Amel,
You can take a look about this github sample that using Objective-C with 10.2.5 SDK to load WMTSLayer:
Looks like you missing the tileMarixSet for layerInfo:
//Triggered by wmtsInfo did load, get populate all the wmtsLayer info
NSArray *layerInfos = [wmtsInfo layerInfos];
//Since third party wmts service, we need to get useful information from the xml file.
//The XML file content an arry of layers, therefore in order to view one specific tile.
//We need to load one element from the arry.
//Get layerInfo and spatial reference from tileMatrixSet
AGSWMTSLayerInfo *layerInfo = layerInfos[1];
layerInfo.tileMatrixSet = layerInfo.tileMatrixSetIds[1];
AGSWMTSLayer *wmtsLayer = [wmtsInfo wmtsLayerWithLayerInfo:layerInfo andSpatialReference:nil];
NSLog(@"WMTSLayer: %@", wmtsLayer.spatialReference);
Hope this can help.
Best Regards,
Nathan
Hi Yue Wu,
thank you for your response. Even if I set the tileMatrixSet property, it still does not work. Did you try to run your code snippet with the url that I provided?
Thank you.
Amel
Hi Amel Mahmuzic,
I haven't tried. I would recommend use Charles Web Debugging Proxy • HTTP Monitor / HTTP Proxy / HTTPS & SSL Proxy / Reverse Proxy , a proxy tool to help you check what kind of requests that you send from either your phone or simulator.
1. You want to make sure is when checking the request is it return 200 or 4xx, 5xx error. Based on the requests you will get more insight what's going on.
2. Do you only load this AGSWMTSLayeror you have other featureLayers load as well? The spatial reference also may causing the AGSWMTSLayer not show up.
Hi Yue Wu,
Charles are Wireshark were the first two applications that I tried.
1. You want to make sure is when checking the request is it return 200 or 4xx, 5xx error. Based on the requests you will get more insight what's going on.
The funny thing here is that I get 404 error since the tile url, that SDK tries to create, does not correspond to TileMatrixSetLink inside of WMTSCapabilities.xml.
Charles returns:
...
...
2. Do you only load this AGSWMTSLayeror you have other featureLayers load as well? The spatial reference also may causing the AGSWMTSLayer not show up.
I only load AGSWMTSLayer without any featureLayers. The spatial reference of the map is also properly loaded (from your code snippet: WMTSLayer: AGSSpatialReference: wkid = 31468, wkt = null)
Thank you,
Best regards.
Amel
I would recommend to check this WMTSLayer's WMTSCapabilities.xml and try to generate the right request from pure POST/GET request using postman.
Once you find the right scheme then you can try to migrate to code to use Runtime iOS SDK to consume it.