Gets the unique internal identifier of this linear or angular Unit, sometimes referred to as the factory code or Well Known ID (WKID). Area units do not have an identifier.

Namespace:  ESRI.ArcGISExplorer.Geometry

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

Syntax

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

Field Value

An integer indicating the unique identifier of this Unit.

Remarks

The types of unit used in coordinate systems, linear and angular, have identifiers. Area units are not used in coordinate systems and do not have identifiers.

You may see this number referred to in some ArcGIS documentation as a factory code, projection engine code, or a Well Known Identifier (WKID). For example, ArcGIS Server web service APIs define WKID parameters which allow you to specify a particular unit; developing for ArcGIS using ArcObjects, these numbers are defined in enumeration sets that begin with 'esriSR', for example the enumerations esriSRUnitType and esriSRUnit2Type define identifiers for types of unit of measurement.

These identifier numbers are based on an industry standard defined by the European Petroleum Survey Group (EPSG), and very occasionally, the code value for which an enumeration stands may change; for this reason it is recommended that you use the enumeration member rather than the numeric value in code. Any changes will be noted in the change reports for this API. You can find out more information about the units and coordinate systems defined by the EPSG at their website, http://www.epsg.org.

Examples

The code below uses .NET reflection to find all of the nested type initializers that create new Unit objects, and then creates an instance of each type of Unit. It then reports on the units by writing to the Debug window using Name property (and Id property where applicable), listing linear, angular and area units separately.
CopyC#
// Get all the different types of Linear units.
System.Reflection.PropertyInfo[] linearProps = typeof(Unit.Linear).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);

// Report linear units.
System.Diagnostics.Debug.WriteLine("Linear Units are:");
foreach (System.Reflection.PropertyInfo prop in linearProps)
{
    Unit u = prop.GetValue(null, null) as Unit;
    System.Diagnostics.Debug.WriteLine(u.Name + "(" + u.Id.ToString() + ")");
}

// Get all the different types of angular units.
System.Reflection.PropertyInfo[] angularProps = typeof(Unit.Angular).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);

// Report angular units.
System.Diagnostics.Debug.WriteLine("Angular Units are:");
foreach (System.Reflection.PropertyInfo prop in angularProps)
{
    Unit u = prop.GetValue(null, null) as Unit;
    System.Diagnostics.Debug.WriteLine(u.Name + "(" + u.Id.ToString() + ")");
}

// Get all the different types of area units.
System.Reflection.PropertyInfo[] areaProps = typeof(Unit.Area).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);

// Report area units.
System.Diagnostics.Debug.WriteLine("Area Units are:");
foreach (System.Reflection.PropertyInfo prop in areaProps)
{
    Unit u = prop.GetValue(null, null) as Unit;
    System.Diagnostics.Debug.WriteLine(u.Name); // Area units do not have identifiers.
}
CopyVB.NET
' Get all the different types of Linear units.
Dim linearProps As System.Reflection.PropertyInfo() = GetType(Unit.Linear).GetProperties(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)

' Report linear units.
System.Diagnostics.Debug.WriteLine("Linear Units are:")
Dim prop As System.Reflection.PropertyInfo
For Each prop In linearProps
    Dim u As Unit = CType(prop.GetValue(Nothing, Nothing), Unit)
    System.Diagnostics.Debug.WriteLine(u.Name & "(" & u.Id.ToString() & ")")
Next

' Get all the different types of angular units.
Dim angularProps As System.Reflection.PropertyInfo() = GetType(Unit.Angular).GetProperties(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)

' Report angular units.
System.Diagnostics.Debug.WriteLine("Angular Units are:")
For Each prop In angularProps
    Dim u As Unit = CType(prop.GetValue(Nothing, Nothing), Unit)
    System.Diagnostics.Debug.WriteLine(u.Name & "(" & u.Id.ToString() & ")")
Next

' Get all the different types of area units.
Dim areaProps As System.Reflection.PropertyInfo() = GetType(Unit.Area).GetProperties(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)

' Report angular units.
System.Diagnostics.Debug.WriteLine("Area Units are:")
For Each prop In areaProps
    Dim u As Unit = CType(prop.GetValue(Nothing, Nothing), Unit)
    System.Diagnostics.Debug.WriteLine(u.Name)    ' Area units do not have Identifiers
Next

See Also