ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Camera Class / Scale Property
Example

In This Topic
    Scale Property (Camera)
    In This Topic
    Gets or sets the Scale of the Camera, as a ratio of distance on the map to reality. This property applies to 2D views only.
    Syntax
    public double Scale {get; set;}
    Public Property Scale As Double
    Remarks
    The Scale property defines the ratio of distance on the map to the corresponding distance on the ground in 2D views. The Scale property value is expressed as a double representing the value on the right side of the ratio. For example a value of 1000 is equal to a scale of 1:1000.
    Example
    Change map frame camera settings
    //Change a map frame's camera settings.
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      //Reference MapFrame
      MapFrame mf = layout.FindElement("Map Frame") as MapFrame;
    
      //Reference the camera associated with the map frame and change the scale
      Camera cam = mf.Camera;
      cam.Scale = 100000;
    
      //Set the map frame extent based on the new camera info
      mf.SetCamera(cam);
    });
    Change map frame extent to single feature with 15 percent buffer
    //Change map frame extent to single feature with 10 percent buffer
    
    //Process on the worker thread
    await QueuedTask.Run(() =>
    {
      //Reference the mapframe and its associated map
      MapFrame mf = layout.FindElement("Map Frame") as MapFrame;
      Map m = mf.Map;
    
      //Reference a feature layer and build a query (to return a single feature)
      FeatureLayer fl = m.FindLayers("GreatLakes").First() as FeatureLayer;
      QueryFilter qf = new QueryFilter();
      string whereClause = "NAME = 'Lake Erie'";
      qf.WhereClause = whereClause;
    
      //Zoom to the feature
      using (ArcGIS.Core.Data.RowCursor rowCursor = fl.Search(qf))
      {
        while (rowCursor.MoveNext())
        {
          //Get the shape from the row and set extent
          using (var feature = rowCursor.Current as ArcGIS.Core.Data.Feature)
          {
            Polygon polygon = feature.GetShape() as Polygon;
            Envelope env = polygon.Extent as Envelope;
            mf.SetCamera(env);
    
            //Zoom out 15 percent
            Camera cam = mf.Camera;
            cam.Scale = cam.Scale * 1.15;
            mf.SetCamera(cam);
          }
        }
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also