ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Geometry Namespace / LinearUnit Class
Members Example

In This Topic
    LinearUnit Class
    In This Topic
    Represents a linear unit of measure used by a Geometry or SpatialReference, or in measurement conversion functions.
    Object Model
    LinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit ClassLinearUnit Class
    Syntax
    public sealed class LinearUnit : Unit 
    Public NotInheritable Class LinearUnit 
       Inherits Unit
    Remarks

    The available linear units of measure.

    Factory Code Unit Name
    9001 International meter
    9002 International foot
    9003 US survey foot
    9005 Clarke's foot
    9014 Fathom
    9030 International nautical mile
    9031 German legal meter
    9033 US survey chain
    9034 US survey link
    9035 US survey mile
    9036 Kilometer
    9037 Yard (Clarke's ratio)
    9038 Chain (Clarke's ratio)
    9039 Link (Clarke's ratio)
    9040 Yard (Sears)
    9041 Sear's foot
    9042 Chain (Sears)
    9043 Link (Sears)
    9050 Yard (Benoit 1895 A)
    9051 Foot (Benoit 1895 A)
    9052 Chain (Benoit 1895 A)
    9053 Link (Benoit 1895 A)
    9060 Yard (Benoit 1895 B)
    9061 Foot (Benoit 1895 B)
    9062 Chain (Benoit 1895 B)
    9063 Link (Benoit 1895 B)
    9070 Foot (1865)
    9080 Indian geodetic foot
    9081 Indian foot (1937)
    9082 Indian foot (1962)
    9083 Indian foot (1975)
    9084 Indian yard
    9085 Indian yard (1937)
    9086 Indian yard (1962)
    9087 Indian yard (1975)
    9093 Statute mile
    9094 Gold Coast foot
    9095 British foot (1936)
    9096 International yard
    109002 US survey yard
    109003 International Chain
    109004 International Link
    109005 Decimeter
    109006 Centimeter
    109007 Millimeter
    109008 International inch
    109009 US survey inch
    109010 International rod
    109011 US survey rod
    109012 US nautical mile (pre 1954)
    109013 UK nautical mile (pre 1970)
    109016 Point
    109030 50 kilometer length
    109031 150 kilometer length
    109406 US square foot

    Example
    Create a new layout using a modified CIM and open it
    //Create a new layout using a modified CIM and open it.
    //The CIM exposes additional members that may not be
    //available through the managed API.  
    //In this example, optional guides are added.
    
    //Create a new CIMLayout on the worker thread
    Layout newCIMLayout = await QueuedTask.Run(() =>
    {
      //Set up a CIM page
      CIMPage newPage = new CIMPage
      {
        //required parameters
        Width = 8.5,
        Height = 11,
        Units = LinearUnit.Inches,
    
        //optional rulers
        ShowRulers = true,
        SmallestRulerDivision = 0.5,
    
        //optional guides
        ShowGuides = true
      };
      CIMGuide guide1 = new CIMGuide
      {
        Position = 1,
        Orientation = Orientation.Vertical
      };
      CIMGuide guide2 = new CIMGuide
      {
        Position = 6.5,
        Orientation = Orientation.Vertical
      };
      CIMGuide guide3 = new CIMGuide
      {
        Position = 1,
        Orientation = Orientation.Horizontal
      };
      CIMGuide guide4 = new CIMGuide
      {
        Position = 10,
        Orientation = Orientation.Horizontal
      };
    
      List<CIMGuide> guideList = new List<CIMGuide>
      {
        guide1,
        guide2,
        guide3,
        guide4
      };
      newPage.Guides = guideList.ToArray();
    
      //Construct the new layout using the customized cim definitions
      var layout_local = LayoutFactory.Instance.CreateLayout(newPage);
      layout_local.SetName("New 8.5x11 Layout");
      return layout_local;
    });
    
    //Open new layout on the GUI thread
    await ProApp.Panes.CreateLayoutPaneAsync(newCIMLayout);
    Create a new spatial map series
    // This example create a new spatial map series and then applies it to the active layout. This will automatically 
    // overwrite an existing map series if one is already present.
    
    //Reference map frame and index layer
    MapFrame mf = layout.FindElement("Map Frame") as MapFrame;
    Map m = mf.Map;
    BasicFeatureLayer indexLyr = m.FindLayers("Countries").FirstOrDefault() as BasicFeatureLayer;
    
    //Construct map series on worker thread
    await QueuedTask.Run(() =>
    {
      //SpatialMapSeries constructor - required parameters
      SpatialMapSeries SMS = MapSeries.CreateSpatialMapSeries(layout, mf, indexLyr, "Name");
      
      //Set optional, non-default values
      SMS.CategoryField = "Continent";
      SMS.SortField = "Population";
      SMS.ExtentOptions = ExtentFitType.BestFit;
      SMS.MarginType = ArcGIS.Core.CIM.UnitType.PageUnits;
      SMS.MarginUnits = ArcGIS.Core.Geometry.LinearUnit.Centimeters;
      SMS.Margin = 1;
      SMS.ScaleRounding = 1000;
      layout.SetMapSeries(SMS);  //Overwrite existing map series.
    });
    Create report
    //Note: Call within QueuedTask.Run()
    //The fields in the datasource used for the report
    //This uses a US Cities dataset
    var listFields = new List<CIMReportField> {
              //Grouping should be the first field
              new CIMReportField{Name = "STATE_NAME", FieldOrder = 0, Group = true, SortInfo = FieldSortInfo.Desc}, //Group cities using STATES
              new CIMReportField{Name = "CITY_NAME", FieldOrder = 1},
              new CIMReportField{Name = "POP1990", FieldOrder = 2, },
          };
    //Definition query to use for the data source
    var defQuery = "STATE_NAME LIKE 'C%'";
    //Define the Datasource
    //pass true to use the selection set
    var reportDataSource = new ReportDataSource(featureLayer, defQuery, false, listFields);
    //The CIMPage defintion - page size, units, etc
    var cimReportPage = new CIMPage
    {
      Height = 11,
      StretchElements = false,
      Width = 6.5,
      ShowRulers = true,
      ShowGuides = true,
      Margin = new CIMMargin { Bottom = 1, Left = 1, Right = 1, Top = 1 },
      Units = LinearUnit.Inches
    };
    
    //Report template
    var reportTemplates = await ReportTemplateManager.GetTemplatesAsync();
    var reportTemplate = reportTemplates.Where(r => r.Name == "Attribute List with Grouping").First();
    
    //Report Styling
    var reportStyles = await ReportStylingManager.GetStylingsAsync();
    var reportStyle = reportStyles.Where(s => s == "Cool Tones").First();
    
    //Field Statistics
    var fieldStatisticsList = new List<ReportFieldStatistic> {
              new ReportFieldStatistic{ Field = "POP1990", Statistic = FieldStatisticsFlag.Sum}
              //Note: NoStatistics option for FieldStatisticsFlag is not supported.
          };
    var report = ReportFactory.Instance.CreateReport("USAReport", reportDataSource, cimReportPage, fieldStatisticsList, reportTemplate, reportStyle);
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Geometry.Unit
          ArcGIS.Core.Geometry.LinearUnit

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also