Gets the type of the geometry which can be stored in the Column.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

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

Field Value

One of the GeometryType values which determine the type of spatial data that can be stored in the Column. Before using this property use the IsSpatial property to check that the Table can store vector data and use the SpatialColumnName to return the name of the spatial Column.

Examples

The code below provides a number of examples for working with ColumnCollection and Column properties. In the third example a check is performed using the GeometryType property to ensure that the Table can store Polygon geometries.
CopyC#
//Open the Regions feature class stored in the Scotland file geodatabase
Geodatabase gdb = new Geodatabase(@"C:\Data\Scotland.gdb");
Table regionsTable = gdb.OpenTable("regions");

//Example 1 - column properties for the non-spatial, "Region" Column
Column regionColumn = regionsTable.Columns["Region"];

System.Diagnostics.Debug.Print(regionColumn.Name);               //Prints "Region"
System.Diagnostics.Debug.Print(regionColumn.AliasName);          //Prints "Region"
System.Diagnostics.Debug.Print(regionColumn.Type.ToString());    //Prints "String"
System.Diagnostics.Debug.Print(regionColumn.Length.ToString());  //Prints "50"

//Check that the parent data container is a geodatabase as the IsNullable and Required column
//properties only apply to this data format
if (regionsTable.Parent is Geodatabase)
{
  System.Diagnostics.Debug.Print(regionColumn.IsNullable.ToString()); //Prints "True"
  System.Diagnostics.Debug.Print(regionColumn.Required.ToString());   //Prints "False"
}

//Example 2 - column properties for the non-spatial, "ObjectID" column
//Check that the Regions table has a unique identifier column
if (regionsTable.Columns.HasObjectIDColumn)
{
  //Get the unique identifier column 
  Column oidColumn = regionsTable.Columns[regionsTable.Columns.ObjectIDColumnName];

  System.Diagnostics.Debug.Print(oidColumn.Name);                   //Prints "OBJECTID"
  System.Diagnostics.Debug.Print(oidColumn.Required.ToString());    //Prints "True"
  System.Diagnostics.Debug.Print(oidColumn.IsNullable.ToString());  //Prints "False"
}

//Example 3 - column properties for the spatial, "Shape" column
//Check that the Regions table can contain vector data
if (regionsTable.IsSpatial)
{
  //Get the column that can store geometry
  Column shapeColumn = regionsTable.Columns[regionsTable.Columns.SpatialColumnName];
  System.Diagnostics.Debug.Print(shapeColumn.Name); //Prints "Shape"
  System.Diagnostics.Debug.Print(shapeColumn.CoordinateSystem.Name); //Prints "British_National_Grid"
  System.Diagnostics.Debug.Print(shapeColumn.HasZ.ToString());       //Prints "False"

  //check that this table can store Polygon geometries
  if (shapeColumn.GeometryType == GeometryType.Polygon)
  {
    //Get the column which stores the perimeter length of each geometry
    Column lengthCol = regionsTable.Columns[regionsTable.Columns.LengthColumnName];
    System.Diagnostics.Debug.Print(lengthCol.Name); //Prints "Shape_Length"

    //Gets the column which stores the area of each geometry
    Column areaCol = regionsTable.Columns[regionsTable.Columns.AreaColumnName];
    System.Diagnostics.Debug.Print(areaCol.Name); //Prints "Shape_Area"
  }
}
CopyVB.NET
'Open regions feature class stored in the Scotland file geodatabase
Dim gdb As Geodatabase = New Geodatabase("C:\Data\Scotland.gdb")
Dim regionsTable As Table = gdb.OpenTable("regions")

'Example 1 - column properties for the non-spatial "Region" Column
Dim regionColumn As Column = regionsTable.Columns.Item("Region")

System.Diagnostics.Debug.Print(regionColumn.Name)               'Prints "Region"
System.Diagnostics.Debug.Print(regionColumn.AliasName)          'Prints "Region"
System.Diagnostics.Debug.Print(regionColumn.Type.ToString())    'Prints "String"
System.Diagnostics.Debug.Print(regionColumn.Length.ToString())  'Prints "50"


'Check that the parent data container is a geodatabase as the IsNullable and Required column
'properties only apply to this data format
If TypeOf regionsTable.Parent Is Geodatabase Then
  System.Diagnostics.Debug.Print(regionColumn.IsNullable.ToString()) 'Prints "True"
  System.Diagnostics.Debug.Print(regionColumn.Required.ToString())   'Prints "False"
End If

'Example 2 - column properties for the non-spatial, "ObjectID" column
'check that the Regions table has a unique identifier column
If (regionsTable.Columns.HasObjectIDColumn) Then
  'Get the unique identifier column
  Dim oidColumn As Column = regionsTable.Columns.Item(regionsTable.Columns.ObjectIDColumnName)

  System.Diagnostics.Debug.Print(oidColumn.Name)                   'Prints "OBJECTID"
  System.Diagnostics.Debug.Print(oidColumn.Required.ToString())    'Prints "True"
  System.Diagnostics.Debug.Print(oidColumn.IsNullable.ToString())  'Prints "False"
End If

'Example 3 - column properties for the spatial, "Shape" column
'check that the Regions table can contain vector data
If regionsTable.IsSpatial Then
  'Get the column that can store geometry
  Dim shapeColumn As Column = regionsTable.Columns.Item(regionsTable.Columns.SpatialColumnName)
  System.Diagnostics.Debug.Print(shapeColumn.Name)                  'Prints "Shape"
  System.Diagnostics.Debug.Print(shapeColumn.CoordinateSystem.Name) 'Prints "British_National_Grid"
  System.Diagnostics.Debug.Print(shapeColumn.HasZ.ToString())       'Prints "False"


  'check that this table can store Polygon geometries
  If shapeColumn.GeometryType = GeometryType.Polygon Then
    'Get the column which stores the perimeter length of each geometry
    Dim lengthCol As Column = regionsTable.Columns.Item(regionsTable.Columns.LengthColumnName)
    System.Diagnostics.Debug.Print(lengthCol.Name) 'Prints "Shape_Length"


    'Gets the column which stores the area of each geometry
    Dim areaCol As Column = regionsTable.Columns.Item(regionsTable.Columns.AreaColumnName)
    System.Diagnostics.Debug.Print(areaCol.Name) 'Prints "Shape_Area"
  End If
End If

See Also