ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping.Offline Namespace / GenerateOfflineMap Class / GetExportRasterTileCacheScales Method
The map containing the raster services
The extent controls the range of scales. A larger extent will usually result in a greater number of scale ranges than a smaller extent.
Example

In This Topic
    GetExportRasterTileCacheScales Method
    In This Topic
    Get the list of scales to use for determining the level of detail, LOD, to use when exporting a raster tile cache. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public List<double> GetExportRasterTileCacheScales( 
       Map map,
       Envelope extent
    )
    Public Function GetExportRasterTileCacheScales( _
       ByVal map As Map, _
       ByVal extent As Envelope _
    ) As List(Of Double)

    Parameters

    map
    The map containing the raster services
    extent
    The extent controls the range of scales. A larger extent will usually result in a greater number of scale ranges than a smaller extent.

    Return Value

    A list of scales or an empty list if there are no exportable raster tile caches
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Map cannot be null
    Extent cannot be null or empty
    Map and extent spatial references must be equal
    Remarks
    If there are multiple raster services present in the TOC then the returned list of scales is derived from a consolidation of all LODs for the raster services (within the specified extent)
    The extent parameter should be the same extent that is used with the ExportTileCacheParams.Extent when exporting the tile cache.
    The extent spatial reference must match the spatial reference of the map or an exception will be thrown.
    If the map has no exportable raster services then an empty list is returned. Raster tile caches include tiled map services and image services.
    Example
    Export Map Raster Tile Cache Content
    //namespace ArcGIS.Desktop.Mapping.Offline
    var extent = MapView.Active.Extent;
    var map = MapView.Active.Map;
    
    //await if needed...
    QueuedTask.Run(() =>
    {
      //Does the map have any exportable raster content?
      var canExport = GenerateOfflineMap.Instance.GetCanExportRasterTileCache(map);
      if (canExport)
      {
        //Check the available LOD scale ranges
        var scales = GenerateOfflineMap.Instance.GetExportRasterTileCacheScales(map, extent);
        //Pick the desired LOD scale
        var max_scale = scales[scales.Count() / 2];
    
        //Configure the export parameters
        var export_params = new ExportTileCacheParams()
        {
          Extent = extent,//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);
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also