Zoom abilities and base map

2687
3
05-22-2013 08:44 PM
ChristopheFondacci
New Contributor II
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,
Christophe.
0 Kudos
3 Replies
RickJones
Occasional Contributor II
I've never used .tpk. Is there a configuration file? Is it possible to override the minimum scale, so the images get pixelly but still zoom in?

We use the exploded tile layer (.jpg). It contains the zoom levels in folders, which I rename to .bundle and move to the Documents folder.  Some modifications to the OfflineTileLayer class were required. I added a feature to grab missing tiles from our server if on WiFi.

There is a configuration file for that format, specifying the scales for each level. If I do not provide a .bundle for that level, and on 3G, the existing images just get stretched until the next level is reached.
0 Kudos
ChristopheFondacci
New Contributor II
Well, I use the "AGSLocalTiledLayer" which loads from a TPK file (some sort of ZIPed cache service export).
I can set minScale, but it does only affect the visibility of the layer, not the zooming capacity. That causes the layer to disappear beyond a given scale level. But still, if this layer is your basemap (the first one added), you won't be able to zoom all scales. Well, at least I don't know how to do...

I think I cannot get the behaviour you have (stretching the most detailed scale available), and I cannot afford to redevelop all this offline layer. I think I might be able to just subclass the AGSLocalTiledLayer to make zooming possible, but I don't really know what to override...

Christophe.
0 Kudos
Dinakarsoma
New Contributor

I am also using AGSLocalTiledLayer. The max scale supported by my TPK file is 5000, but I am looking to achieve the scale 1250. I was able to zoom in to the scale 1250 by setting the maxscale = 1250 to both my localTiledLayer and mapView. Doing this, I am able to zoom to scale 1250 (The last tiled image is zoomed/pixelated). I think we should be happy that the last tile is pixelated instead disappear altogether. I am not sure if this is what you were looking for.

My other requirement is at the scale of 1250, when the user pans the map, the tile available at 5000 (last tile) should be loaded with pixelated view. Right now, when I pan outside my visible extent at 1250, there is no background/base map.

Do you have any thoughts or approach that I can try?

0 Kudos