ArcGIS Explorer Component Help |
IndexCollection..::.HasSpatialIndex Property |
IndexCollection Class Example See Also |
Gets a value indicating whether a spatially enabled Table has a spatial index.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public bool HasSpatialIndex { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property HasSpatialIndex As Boolean |
Field Value
trueTruetruetrue (True in Visual Basic) if the Table has spatial index; otherwise, falseFalsefalsefalse (False in Visual Basic). This property only applies where IsSpatial is true.Examples
The code below uses the HasSpatialIndex property to check whether a Table has a spatial index and if not the user
is prompted to add one.
CopyC#
//Open feature class Table countriesTable = Table.OpenFileGeodatabaseTable(@"C:\Data\World.gdb", "Countries"); //Return a collection containing all indexes in the Countries table IndexCollection indexes = countriesTable.Indexes; //Example 1 - Use a for each loop to iterate over all indexes in the collection foreach (Index indx in indexes) { //Print index name System.Diagnostics.Debug.Print(indx.Name); //Print whether the index is a unique index System.Diagnostics.Debug.Print(string.Format("Unique: {0}", indx.IsUnique.ToString())); //Print whether the index is an ascending index System.Diagnostics.Debug.Print(string.Format("Ascending: {0}", indx.IsAscending.ToString())); } //Example 2 - alternative approach - use a for/next loop to iterate over all indexes in the collection by "index" position for (int i = 0; i < indexes.Count; i++) { Index ind = indexes[i]; //Print the name of each index System.Diagnostics.Debug.Print(ind.Name); } //Example 3 - access a specific index by Name Index capitalIndex = indexes["Capital"];
CopyVB.NET
'Open feature class Dim countriesTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\World.gdb", "Countries") 'Return a collection containing all indexes in the Countries table Dim indexes As IndexCollection = countriesTable.Indexes 'Example 1 - Use a for each loop to iterate over all indexes in the collection For Each indx As Index In indexes 'Print index name System.Diagnostics.Debug.Print(indx.Name) 'Print whether the index is a unique index System.Diagnostics.Debug.Print(String.Format("Unique: 0", indx.IsUnique.ToString())) 'Print whether the index is an ascending index System.Diagnostics.Debug.Print(String.Format("Ascending: 0", indx.IsAscending.ToString())) Next 'Example 2 - alternative approach - use a for/next loop to iterate over all indexes in the collection by "index" position For i As Integer = 0 To indexes.Count - 1 Dim ind As Index = indexes.Item(i) 'Print the name of each index System.Diagnostics.Debug.Print(ind.Name) Next 'Example 3 - access a specific index by Name Dim capitalIndex As Index = indexes.Item("Capital")