Parameters
- map
- The map to check for raster tile cache content
Return Value
True if the map contains any tiled map or image services
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
| System.ArgumentNullException | The value of the map parameter cannot be null |
{
//Does the map have any exportable raster content?
var canExport = GenerateOfflineMap.Instance.GetCanExportRasterTileCache(map);
var rasterTileExtent = MapView.Active.Extent;
if (canExport)
{
//Check the available LOD scale ranges
var scales = GenerateOfflineMap.Instance.GetExportRasterTileCacheScales(map, rasterTileExtent);
//Pick the desired LOD scale
var max_scale = scales[scales.Count() / 2];
//Configure the export parameters
var export_params = new ExportTileCacheParams()
{
Extent = rasterTileExtent,//Use same extent as was used to retrieve scales
MaximumUserDefinedScale = max_scale
//DestinationFolder = .... (optional)
};
//If DestinationFolder is not set, output defaults to project
//offline maps location set in the project properties. If that is
//not set, output defaults to the current project folder location.
//Do the export. Depending on the MaximumUserDefinedScale and the
//area of the extent requested, this can take minutes for tile packages
//over 1 GB or less if your network speed is slow...
GenerateOfflineMap.Instance.ExportRasterTileCache(map, export_params);
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)