Indicates the type of units (linear, angular, or area) used by the coordinates of Geometry or
CoordinateSystem, or used in a measurement or conversion function.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public enum UnitType |
Visual Basic (Declaration) |
---|
Public Enumeration UnitType |
Members
Member name | Description | |
---|---|---|
Angular |
Specifies angular units of measurement, for example those used in polar coordinates such as Degrees or Radians.
Angular units are used by geographic coordinate systems.
| |
Linear |
Specifies linear units of measurement, for example those measuring distance such as Meters or Miles.
Linear units are used by projected coordinate systems, and in measurement and conversion functions.
| |
Area |
Specifies areal units of measurement, for example those measuring areas such as Hectares and Square Meters.
Area units are used in measurement and conversion functions.
|
Remarks
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