WMTS - TileCol, TileRow and zoom are always 0

1938
2
07-11-2018 08:20 AM
NataliaOsiecka
New Contributor

Question about ArcGIS for iOS version 100.2.1.

I can't display the layer via WMTS, even though the request seems to be fine. `TileCol`, `TileRow` and zoom in `TileMatrix` are 0. I've debugged my demo app with Charles, `GetCapabilities` request is passing fine. The app receives the layers, selects the proper one. But in `GetTile` request, the request is wrong. Because relevant code snippet is very short I'm pasting it here:

private func createMap() {

        self.map = AGSMap()

        self.map.initialViewpoint = AGSViewpoint(latitude: 52, longitude: 0, scale: 9)

        self.mapView.map = self.map

        self.wmtsService = AGSWMTSService(url: mapLink())

        self.wmtsService.load {[weak self] (error) in

            if let error = error {

                print("Failed to load WMTS layer: \(error.localizedDescription)")

                return

            }

            guard let `self` = self, let wmtsServiceInfo = self.wmtsService.serviceInfo else { return }

            let selectedLayerInfo = wmtsServiceInfo.layerInfos.filter({ $0.layerID == "MyLayerID" }).first ?? wmtsServiceInfo.layerInfos[0]

            self.map.basemap = AGSBasemap(baseLayer: AGSWMTSLayer(layerInfo: selectedLayerInfo))

        }

    }

So firstly the request for `getCapabiities` is sent and it's looking fine - all elements: `scheme://host/path?args` are matching expected values (I've debugged it with Charles). I can see Esri receives 200 here, and the response is valid.

The next step ArcGIS should do, is to add `TileCol`, `TileRow`, and it does it, with 0 (captured it in Charles), it also changes the zoom in `TileMatrix` to 0. As a result, this particular API response is 403, but that's the bug of the API.

In fact, when I paste this request to Postman and change the value of zoom inside `TileMatrix` (the map does not support zoom 0) to 9, I receive the error with type TileOutOfRange. This is proper because the map is only containing a part of the world (the UK in particular), and point 0,0 is not there. When I change `TileCol`, `TileRow` to real values the request passes with 200 and a tile is returned in the response. 


So my question is why isn't ArcGIS asking for the given location? I've set initialViewpoint, and it is still filling the request with 0,0,0 as tileCol, tileRow and zoom in tileMatrix.

The map does not load at all as a result, because ArcGIS is asking in this order (captured by Charles):
1) getCapabilities (response 200)
2) getTile (at 0,0,0; response 403)

3) getTile (at 0,0,0; response 403)

4) infinite number of calls for getCapabilities (response 200)

The map is empty. The network traffic is huge. Can I do anything to make it work (it's not opensource, I can't edit it)? Changing map API is not possible.

--- PS. ---

It's also worth to notice, that GetCapabilities is responding with following json:

<TileMatrixSetLink>
 <TileMatrixSet>EPSG:3857</TileMatrixSet>
 <TileMatrixSetLimits>
 <TileMatrixLimits>
 <TileMatrix>EPSG:3857:7</TileMatrix>
 <MinTileRow>36</MinTileRow>
 <MaxTileRow>43</MaxTileRow>
 <MinTileCol>60</MinTileCol>
 <MaxTileCol>64</MaxTileCol>
 </TileMatrixLimits>


and so on up to zoom level 20. So ArcGIS could know that 0,0,0 is not valid even from GetCapabilities file.

Tags (3)
0 Kudos
2 Replies
DiveshGoyal
Esri Regular Contributor

Have you tried with runtime version 100.3 to see if it works any better?

Also, can you share your service so that we may debug this case

0 Kudos
NataliaOsiecka
New Contributor

Unfortunately, we resigned from ArcGIS. Not being able to debug the code inside your framework while having such big black box components (which, as always, sometimes happen not to work properly) is a major threat for us and we've decided to use opensource libraries - this way we're able to fix it ourselves or add specific functionality we need.

For your debugging needs: service was this one: WMTS · OS APIs.

0 Kudos