Rendering Compact Cache stored on SD Card as MapView

3747
2
Jump to solution
02-22-2015 01:56 AM
omega_cancer
Occasional Contributor II

I am new to ArcGIS Android Runtime SDK.

I want to make use of .bundle and .bundlex (compact cache files) that are stored on SD card. I want to create map from them.

I was not able to find any sample for this so do anybody have any code snippet for it.

Thanks

0 Kudos
1 Solution

Accepted Solutions
MengyiGuo
Occasional Contributor

Hi Abdul,

Please check out this sample:

Export Tile Cache | ArcGIS for Developers

The Sample uses ExportTileCacheParameters class to which lets you specify if the downloaded tile cache will be a tile package(tpk) or a compact cache,and the default download location is<EXTERNAL-STORAGE-DIR>/ArcGIS/samples/tiledcache/

I'll bring the main Code Snippet:

// Create an instance of ExportTileCacheTask for the mapService that

// supports the exportTiles() operation

final ExportTileCacheTask exportTileCacheTask = new ExportTileCacheTask( tileURL, null); 

// Set up GenerateTileCacheParameters

ExportTileCacheParameters params = new ExportTileCacheParameters( createAsTilePackage, levels, ExportBy.ID, extentForTPK, mMapView.getSpatialReference()); 

// create tile cache

createTileCache(params, exportTileCacheTask, tileCachePath);

private void createTileCache(ExportTileCacheParameters params, final ExportTileCacheTask exportTileCacheTask, final String tileCachePath) {

// Submit tile cache job and download

exportTileCacheTask.generateTileCache(params, statusListener, new CallbackListener<String>() {

 

@Override public void onCallback(String path)

{

Log.d("the Download Path = ", "" + path); 

// switch to the successfully downloaded local layer

localTiledLayer = new ArcGISLocalTiledLayer(path);

mMapView.addLayer(localTiledLayer);

}

}

}

View solution in original post

2 Replies
MengyiGuo
Occasional Contributor

Hi Abdul,

Please check out this sample:

Export Tile Cache | ArcGIS for Developers

The Sample uses ExportTileCacheParameters class to which lets you specify if the downloaded tile cache will be a tile package(tpk) or a compact cache,and the default download location is<EXTERNAL-STORAGE-DIR>/ArcGIS/samples/tiledcache/

I'll bring the main Code Snippet:

// Create an instance of ExportTileCacheTask for the mapService that

// supports the exportTiles() operation

final ExportTileCacheTask exportTileCacheTask = new ExportTileCacheTask( tileURL, null); 

// Set up GenerateTileCacheParameters

ExportTileCacheParameters params = new ExportTileCacheParameters( createAsTilePackage, levels, ExportBy.ID, extentForTPK, mMapView.getSpatialReference()); 

// create tile cache

createTileCache(params, exportTileCacheTask, tileCachePath);

private void createTileCache(ExportTileCacheParameters params, final ExportTileCacheTask exportTileCacheTask, final String tileCachePath) {

// Submit tile cache job and download

exportTileCacheTask.generateTileCache(params, statusListener, new CallbackListener<String>() {

 

@Override public void onCallback(String path)

{

Log.d("the Download Path = ", "" + path); 

// switch to the successfully downloaded local layer

localTiledLayer = new ArcGISLocalTiledLayer(path);

mMapView.addLayer(localTiledLayer);

}

}

}

View solution in original post

omega_cancer
Occasional Contributor II

Thanks for the reply.

0 Kudos