Mobile Flex Zoom into Tile Package

2785
10
01-29-2013 04:12 AM
MattSheehan
Occasional Contributor III
We are using tile packages generated in ArcMap 10.1. Zooming to building level is failing on the mobile. The steps are as follows:

1) Open TIF in ArcMap 10.1. Zoom to buildings/bushes looks good:

http://webmapsolutions.com/assets/blog/tpk/tpk1.jpg

2) Generate TPK in ArcMap 10.1 and set highest level of detail of 20:

http://webmapsolutions.com/assets/blog/tpk/tpk2.jpg

3) Copy TPK to mobile device and write simple Flex Mobile app to display tpk:

http://webmapsolutions.com/assets/blog/tpk/tpk3.jpg

4) The above is the farthest the app will zoom before we lose the imagery:

http://webmapsolutions.com/assets/blog/tpk/tpk4.jpg

The simple Flex mobile code is included below. We added LODs without success:

<fx:Script>
  <![CDATA[
   import com.esri.ags.layers.ArcGISLocalTiledLayer;
   import com.esri.ags.layers.supportClasses.LOD;
   import com.esri.ags.events.MapEvent;
  
   private function init():void
   {
   
    map.addEventListener(MapEvent.LOAD, addLODs);
   
    const filetpk:File = File.documentsDirectory.resolvePath("Download/Untitled.tpk");
    if(filetpk.exists)
    {
     var localTPK:ArcGISLocalTiledLayer = new ArcGISLocalTiledLayer();
     localTPK.name = "offlinelayer";
     localTPK.file = filetpk;
     localTPK.visible = true;
    
     map.addLayer(localTPK);
    
    }
   }
  
   private function addLODs(e:Event):void
   {
    var lods:Array = map.lods;
    lods.push(new LOD(NaN, 0.6, 3000));
    lods.push(new LOD(NaN, 0.3, 1500));
    lods.push(new LOD(NaN, 0.1, 500));
    map.lods = lods;
   }

  ]]>
</fx:Script>

<esri:Map id="map"/>

We wondered if anybody had thoughts on getting past this zoom limit?

Thanks

--Rory
Tags (2)
0 Kudos
10 Replies
YannCabon
Esri Contributor
Hi Rory,

The tiled layers only display tiles if it has tiles available at the current LOD of the map
In your case, you are adding LOD for the scales 3000, 1500 and 500.

lods.push(new LOD(NaN, 0.6, 3000));
lods.push(new LOD(NaN, 0.3, 1500));
lods.push(new LOD(NaN, 0.1, 500));

The level 19 of your TPK has a scale of 1,128.49 and I guess the levels 18 a scale of 2256.99 and 17, 4513.98.

So the map will work like this:

scale 4513.98: display tiles
custom LOD scale 3000: no tiles
scale 2256.99: display tiles
custom LOD scale 1500: no tiles
scale 1,128: display tiles
custom LOD scale 500: no tiles

Yann
0 Kudos
MattSheehan
Occasional Contributor III
Thanks for the rely Yann. Should have thought this one through more. Still nudge me a little. I took a look at the tpk generator (share as -> tie package) in ArcMap 10.1 which game me the following:

http://webmapsolutions.com/assets/blog/mapunits.jpg

From this i replaced my LODs above (possibly mistakenly) with the following and variations:

var lods:Array = map.lods;
    lods.push(new LOD(NaN, 4.777314, 18055.954822));
    lods.push(new LOD(NaN, 2.388657, 9027.977411));
    lods.push(new LOD(NaN, 1.194329, 4513.988705));
    lods.push(new LOD(NaN, 0.597164, 2256.994353));
    lods.push(new LOD(NaN, 0.298582, 1128.497176));
    map.lods = lods;

I'm still not getting to the maximum scale. Looks like it is topping out at around 1:5000.

Thx

--Rory
0 Kudos
YannCabon
Esri Contributor
Ok, let's dig a little more 🙂

Do you have a basemap, or it's the one?
can you give me the list of LODs you already have in the map?

var lods:Array = map.lods;
for each (var lod:LOD in lods)
{
    trace(lod.toString());
}

Can you also check the lods in the layer?

lods =  localTPK.tileInfo.lods;
for each (lod in lods)
{
    trace(lod.toString());
}
0 Kudos
MattSheehan
Occasional Contributor III
Thanks for your help here Yann. I put the following into the code based on your suggestion:

    var lods2:Array = map.lods;
    for each (var lod3:LOD in lods2)
    {
     trace("map lods " + lod3.toString());
    }
   
    var lods4 = localTPK.tileInfo.lods;
    for each (var lod5:LOD in lods4)
    {
     trace("tpk lods " + lod5.toString());
    }

The output looks the same for both the tpk and the map see below:

http://webmapsolutions.com/assets/blog/tpklods.jpg

http://webmapsolutions.com/assets/blog/maplods.jpg

--Rory
0 Kudos
NoboruNAKURA1
New Contributor II
Hello Yann,

I have already reported this issue.

NIM-087717: AIR application with ArcGISLocalTiledLayer does not show TPKs at larger scales(such as 1:2500 or 1:1000).
http://support.esri.com/en/bugs/nimbus/role/distributor/TklNMDg3NzE3
0 Kudos
YannCabon
Esri Contributor
Yes, thanks!
0 Kudos
CaseyBentz
Occasional Contributor II
Yes, thanks!


I am having this same problem.  Any ideas on how to fix this?
0 Kudos
YannCabon
Esri Contributor
Hi,

This is a bug in the ArcGISLocalTiledLayer and it will be fixed in 3.2
In the meantime open your tpk file as a zip file and go to the folders v101\Layers\_alllayers\L18 and v101\Layers\_alllayers\L19 and modify the file names as such as it should like RxxxxCxxxx instead of RxxxxxCxxxxxx.

Make sure not to uncompress the tpk, edit the name directly in the archive.

Thanks
0 Kudos
NoboruNAKURA1
New Contributor II
Thanks, Yann. I have fixed this issue.
0 Kudos