ArcGIS Explorer Component Help |
Column..::.HasZ Property |
Column Class Example See Also |
Gets a value indicating whether the Column is capable of storing Z (typically height) values. This property
only applies to the spatial column in a Table which can store vector data.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
Field Value
trueTruetruetrue (True in Visual Basic) if the Column is capable of storing Z values; otherwise, falseFalsefalsefalse (False in Visual Basic). 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 the HasZ property is printed out for the spatial Shape column.
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