Zoom abilities and base map

Discussion created by on May 22, 2013
Latest reply on Jul 5, 2017 by dinakarsoma2
Hi everybody !

Here is the context :

  • My app supports offline mode by providing a layer loaded through a TPK file

  • When the app has Wifi / 3G access, data is displayed through a tiled map service layer

Here is my problem :
The data from the TPK are for a zoom scale of 100000. My map service provides much better zoom scales. What I would like to do is to be able to add my "offline" layer (the local layer from my TPK) first, then my map service layer, then feature layers, then sketch layer, etc. This way, I would display the "offline" layer only if my map service is not available, as a fallback.

The problem with this configuration is that I can only zoom in to the max scale of my offline layer... which is a shame because when map service is accessible, I can have much more detailed information.

The workaround I used is to first detect if network is reachable and then if so omit addition of the offline layer and add the map service layer first as the base. But then as soon as the network becomes unreachable I need to remove all layers and re-add the offline layer first and then all the others. This results in hugly code, but it works.

But one problem subsists when we start the app with unreachable network : in this situation the offline layer is loaded first (as no map will be loaded if I add the unreachable map service layer first) and I could not zoom more than the resolution of the TPK. Even when network becomes reachable again, removing all layers to put the map service layer in first place does not change anything.

Is there any way to allow zooming in to "the best possible resolution from all layers" ? Or at least to override the max zoom scale to programmatically allow zooming in more than normal ?

What would you advise to do in this situation ?

Thank you very much,