关于arcpy中Table,FeatureClass处理中常用工具整理

1、遍历工具:

ListFeatureClasses ({wild_card}, {feature_type}, {feature_dataset})

ListTables ({wild_card}, {table_type})

相关链接:http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#/na/000v0000001t000000/

 

2、操作Row,包括insert、delete、update。

    首先,用游标Cursor,逐行扫描Row,找到需要修改的行(Cursor详细内容:http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#/na/000v00000068000000/),在遍历FeatureClass,所用到的遍历方式有
InsertCursor,SearchCursor,UpdateCursor三种,具体信息(http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#/na/000v00000068000000/)。

    通过三种不同的Cursor,执行对应的操作,常用才Cursor操作见下表:

方法 说明
deleteRow (row)

Deletes a row in the database. The row corresponding to the current position of the cursor will be deleted.

insertRow (row)

Inserts a new row into the database.

newRow ()

Creates an empty row object.

next ()

Returns the next object at the current index.

reset ()

Sets the current enumeration index (used by the next method) back to the first element.

updateRow (row)

The updateRow method can be used to update the row at the current position of an update cursor.

另Row的方法:来源(http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html#/na/000v000000nv000000/

 

方法 说明
getValue (field_name)

Gets the field value.

isNull (field_name)

Is the field value null.

setNull (field_name)

Sets the field value to null.

setValue (field_name, object)

Sets the field value.

 

 

 

转载自:https://blog.csdn.net/haichao062/article/details/8109427

You may also like...

退出移动版