Shapefile attribute table

Functions

int Shapefile.EditAddField (string Name, FieldType Type, int Precision, int Width)
 Adds a field to the attribute table of the shapefile. The table must be in editing mode. More...
 
bool Shapefile.EditCellValue (int FieldIndex, int ShapeIndex, object newVal)
 Sets the new value for particular cell in attribute table. The table must be in editing mode. More...
 
bool Shapefile.EditDeleteField (int FieldIndex, ICallback cBack)
 Deletes a field with the specified index from the attribute table. The table must be in editing mode. More...
 
bool Shapefile.EditInsertField (Field NewField, ref int FieldIndex, ICallback cBack)
 Inserts a new field in the shapefile attribute table. The table must be in editing mode. More...
 
object Shapefile.get_CellValue (int FieldIndex, int ShapeIndex)
 Gets the value of the specified field for the shape. More...
 
Field Shapefile.get_Field (int FieldIndex)
 Gets a specific field stored in the attribute table. More...
 
Field Shapefile.get_FieldByName (string Fieldname)
 Gets specific field stored in the attribute table. More...
 
int Shapefile.get_FieldIndexByName (string FieldName)
 Gets index of field with specified name. More...
 
bool Shapefile.StartEditingTable (ICallback cBack)
 Opens editing mode for the attribute table. More...
 
bool Shapefile.StopEditingTable (bool ApplyChanges, ICallback cBack)
 Closes the editing mode for the attribute table. More...
 

Properties

bool Shapefile.EditingTable [get]
 Gets the value indicating whether editing operations are allowed for shapefile attribute table. More...
 
int Shapefile.NumFields [get]
 Gets the number of fields in attribute table of the shapefile. More...
 
Table Shapefile.Table [get]
 Gets the reference to the attribute table associated with the shapefile. More...
 

Detailed Description

Here is a list of properties and methods to for interaction with attribute table associated with a shapefile. This module is a part of the documentation of Shapefile class.

dot_inline_dotgraph_27.png

Graph description

Function Documentation

◆ EditAddField()

int Shapefile.EditAddField ( string  Name,
FieldType  Type,
int  Precision,
int  Width 
)

Adds a field to the attribute table of the shapefile. The table must be in editing mode.

Parameters
NameThe name of field.
TypeThe type of field.
PrecisionThe precision of field.
WidthThe width of field.
Returns
The index of the new field or -1 on failure.
Examples:
AddCategoryRange.cs, CreateBuffer.cs, RemoveShape.cs, and Segmentation.cs.

◆ EditCellValue()

bool Shapefile.EditCellValue ( int  FieldIndex,
int  ShapeIndex,
object  newVal 
)

Sets the new value for particular cell in attribute table. The table must be in editing mode.

Parameters
FieldIndexThe index of field in attribute table.
ShapeIndexThe index of shape (row number in attribute table).
newValThe variant value to be passed (integer, double and string values are accepted depending on field type).
Returns
True on success and false otherwise.
Examples:
AddCategoryRange.cs, CalculateArea.cs, CreateBuffer.cs, EditAttributes.cs, IntersectionLength.cs, MinimalDistance.cs, and Segmentation.cs.

◆ EditDeleteField()

bool Shapefile.EditDeleteField ( int  FieldIndex,
ICallback  cBack 
)

Deletes a field with the specified index from the attribute table. The table must be in editing mode.

Parameters
FieldIndexAn index of field to be deleted.
cBackAn instance of class implementing ICallback interface. It's recommended to pass NULL and use Shapefile.GlobalCallback property instead.
Returns
Returns true on success and false otherwise

◆ EditInsertField()

bool Shapefile.EditInsertField ( Field  NewField,
ref int  FieldIndex,
ICallback  cBack 
)

Inserts a new field in the shapefile attribute table. The table must be in editing mode.

Parameters
NewFieldA new instance of field object to insert.
FieldIndexA position to insert the new field. An invalid index will be automatically substituted with 0 or Shapefile.NumFields.
cBackAn instance of class implementing ICallback interface. It's recommended to pass NULL and use Shapefile.GlobalCallback property instead.
Returns
True on success and false otherwise.
Examples:
IntersectionLength.cs, and MinimalDistance.cs.

◆ get_CellValue()

object Shapefile.get_CellValue ( int  FieldIndex,
int  ShapeIndex 
)

Gets the value of the specified field for the shape.

The value will be returned as VARIANT data type. When passing to then .NET it will be converted to either integer, double or string data type depending on the type of field.

Parameters
FieldIndexThe index of field.
ShapeIndexThe index of shape.
Returns
The value stored in the field.
Examples:
ShowAttributes.cs, and ZoomToValues.cs.

◆ get_Field()

Field Shapefile.get_Field ( int  FieldIndex)

Gets a specific field stored in the attribute table.

Parameters
FieldIndexThe index of the field to be retrieved.
Returns
Reference to the field object or NULL reference on failure.

◆ get_FieldByName()

Field Shapefile.get_FieldByName ( string  Fieldname)

Gets specific field stored in the attribute table.

Parameters
FieldnameThe name of the field to be retrieved. The comparison of the names is case insensitive.
Returns
Reference to the field object or NULL reference on failure.

◆ get_FieldIndexByName()

int Shapefile.get_FieldIndexByName ( string  FieldName)

Gets index of field with specified name.

Parameters
FieldNameField name.
Returns
Index of field in attribute table or -1 if no such field is found.
New API 4.9.3:
Added in version 4.9.3

◆ StartEditingTable()

bool Shapefile.StartEditingTable ( ICallback  cBack)

Opens editing mode for the attribute table.

Parameters
cBackA callback object to report errors and progress information.
Returns
True on success and false otherwise.
Examples:
AddCategoryRange.cs, and CalculateArea.cs.

◆ StopEditingTable()

bool Shapefile.StopEditingTable ( bool  ApplyChanges,
ICallback  cBack 
)

Closes the editing mode for the attribute table.

Parameters
ApplyChangesA boolean value which indicates whether changes made to the memory version of table should be saved to the drive.
cBackA callback object to report errors and progress information.
Returns
True on success and false otherwise.
Examples:
CalculateArea.cs.

Properties

◆ EditingTable

bool Shapefile.EditingTable
get

Gets the value indicating whether editing operations are allowed for shapefile attribute table.

Use Shapefile.StartEditingTable and Shapefile.StopEditingTable to control editing mode.

Examples:
CalculateArea.cs.

◆ NumFields

int Shapefile.NumFields
get

Gets the number of fields in attribute table of the shapefile.

Examples:
EditAttributes.cs, MinimalDistance.cs, and ShowAttributes.cs.

◆ Table

Table Shapefile.Table
get

Gets the reference to the attribute table associated with the shapefile.

Examples:
AddCategoryRange.cs, CalculateArea.cs, EditAttributes.cs, PointIcons.cs, SelectBox.cs, ShowAttributes.cs, SplitByAttribute.cs, and ToolTip.cs.