ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping.Offline Namespace / ExportTileCacheParams Class / MaximumUserDefinedScale Property
Example

In This Topic
    MaximumUserDefinedScale Property
    In This Topic
    Gets and sets the maximum scale of data in the tile cache.
    Syntax
    public double MaximumUserDefinedScale {get; set;}
    Public Property MaximumUserDefinedScale As Double
    Remarks
    Use GenerateOfflineMap.GetExportRasterTileCacheScales and GenerateOfflineMap.GetExportVectorTileCacheScales to get a list of available scales for tile cache content in the map. The selected scale specified in MaximumUserDefinedScale is compared to the LODs of the tile cache content in the map to determine the specific LOD for a given tile cache to export. The LOD, for a given tile cache, containing the specified scale is the LOD that will be used.
    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);
      }
    });
    Export Map Vector 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 vector tile content?
      var canExport = GenerateOfflineMap.Instance.GetCanExportVectorTileCache(map);
      if (canExport)
      {
        //Check the available LOD scale ranges
        var scales = GenerateOfflineMap.Instance.GetExportVectorTileCacheScales(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 = @"C:\Data\Offline"
        };
        //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.ExportVectorTileCache(map, export_params);
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also