Returns a value indicating if this Unit represents linear, angular or area units of measurement.

Namespace:  ESRI.ArcGISExplorer.Geometry

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public UnitType UnitType { get; }
Visual Basic (Declaration)
Public ReadOnly Property UnitType As UnitType

Field Value

A UnitType representing the type of unit.

Remarks

Each instance of the Unit class may represents either a linear, angular, or area unit of measurement. All types of measurement are used in measurement and measurement conversion functions; only linear or angular units are used as the units of a CoordinateSystem.

The coordinates of a Geometry are defined by its coordinate system. Geographic coordinate systems use angular units, defining coordinates in terms of latitude and longitude, which are angles calculated from the center of the earth describing a position on its surface. Coordinates described in this way are sometimes referred to as polar coordinates. Projected coordinate systems use linear units, defining positions on the earths surface as coordinates on earths surface as projected to a flat plane. For this reason, the coordinates of a Geometry may be specified in linear or angular units, depending on the coordinate system used by the Geometry.

Examples

The code below uses the UnitType property to determine if the CoordinateSystem of an existing Point uses linear or angular Units, and then reports the X an Y coordinates; the code uses the LatitudeToString and LongitudeToString static methods on Unit to format the angular units strings.
CopyC#
// NOTE: existingPoint should be an existing Point with a CoordinateSystem set.
UnitType pointUnitType = existingPoint.CoordinateSystem.Unit.UnitType;

System.Text.StringBuilder sb = new System.Text.StringBuilder("Coordinates of the point are:");
sb.AppendLine();

// If the Point has angular units
if (pointUnitType == UnitType.Angular)
{
    sb.AppendLine("Latitude = " + existingPoint.Y.ToString());
    sb.AppendLine("Longitude = " + existingPoint.X.ToString());
}
else if (pointUnitType == UnitType.Linear)
{
    sb.AppendLine("X = " + existingPoint.X.ToString());
    sb.AppendLine("Y = " + existingPoint.Y.ToString());
}
CopyVB.NET
' NOTE: existingPoint should be an existing Point with a CoordinateSystem set.
Dim pointUnitType As UnitType = existingPoint.CoordinateSystem.Unit.UnitType

Dim sb As New System.Text.StringBuilder("Coordinates of the point are:")
sb.AppendLine()

' If the Point has angular units
If pointUnitType = UnitType.Angular Then
    sb.AppendLine("Latitude = " & existingPoint.Y)
    sb.AppendLine("Longitude = " & existingPoint.X)
ElseIf pointUnitType = UnitType.Linear Then
    sb.AppendLine("X = " & existingPoint.X.ToString())
    sb.AppendLine("Y = " & existingPoint.Y.ToString())
End If

See Also