Select to view content in your preferred language

Rendering Compact Cache stored on SD Card as MapView

4197
2
Jump to solution
02-22-2015 01:56 AM
omega_cancer
Frequent Contributor

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
Deactivated User

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
Deactivated User

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);

}

}

}

omega_cancer
Frequent Contributor

Thanks for the reply.

0 Kudos