.tpk supported or not?

3470
6
02-26-2013 05:51 AM
AxelBronder
New Contributor
Hi,

I have tried reading from local storage using the Samples:
http://www.arcgis.com/home/item.html?id=d2d263a280164a039ef0a02e26ee0501
where it says: "With the ArcGIS for Android SDK local data can be a compact cache or tile package (.TPK)"

The sample works great for the provided compact cache example, but it is also supposed to work for .tpk files, right? In the source-code comments, however, it says the following:
"(Tile Packages or .tpk's are not currently supported)." This was written sometime in 2012, probably june.

I have tried reading a .tpk-file I have generated in ArcMap (http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000017w000000) but it does not display.

So: Is reading .tpk-files from local storage currently supported or not? If so, could you give me a path-example? (Simply giving the path to the file on the SD does not seem to work).
0 Kudos
6 Replies
JonMayfield
New Contributor
This works for me:
mapView.AddLayer (new Com.Esri.Android.Map.Ags.ArcGISLocalTiledLayer ("file:///mnt/sdcard/map.tpk"));
0 Kudos
AxelBronder1
New Contributor
Think I am doing the same thing, though:

  File storage= Environment.getExternalStorageDirectory();
  String dir = storage + "TPKs/test3.tpk";
 
  local = new ArcGISLocalTiledLayer(dir);

  map.addLayer(local);

So, since it is working for you it might be something wrong with my .apk
I'll try rebuilding it, or getting one from somewhere else...
0 Kudos
DanO_Neill
Occasional Contributor III
ArcGISLocalTiledLayer class can take a path to your *.tpk file on disk.  Look at the CreateLocalJsonFeatures sample for an example.  In the sample you will see the resource in res/config.xml file and the Local Tile Layer added in LocalMapActivity class.
0 Kudos
AxelBronder1
New Contributor
Found out I wasn't using the latest version of the api, got it working when I updated to 10,1,1
0 Kudos
eddiequinlan
Occasional Contributor
I'm having a tough time with this too.  Here's what I'm doing.  Can someone advise if this is correct?



[Bindable] private var f:File = new File();
   
private function init():void
{   
      f.nativePath = "/sdcard/ArcGISApp/MapData/MobileParcelsMap.tpk";   
}

<esri:Map ......>
<esri:ArcGISLocalTiledLayer id="Pcl_tpk"  file="{f}" />
</esri:Map>

Am I trying to make this too simple?

Eddie
0 Kudos
eddiequinlan
Occasional Contributor
Ok, I figured my problem out.  I didn't realize when testing on the mobile device you had to uninstall the previous .apk file.  I was just replacing the file and running the app again.  Therefore, any program changes I was making wasn't being updated on the Android.  Once I uninstalled the app and re-installed the new code, the maps were there.  My code was working after all.

thanx and hope this may help anyone,
eddie
0 Kudos