向要素类、shapefile 或表中插入行。InsertCursor 返回一个分发行对象的枚举对象。
可使用 newRow 方法从插入行的枚举对象获取新的行对象。每次调用光标上 insertRow 都会在表中创建新行,该行的初始值设置为输入行中的值。
参数 | 说明 | 数据类型 |
dataset
|
The table, feature class, or shapefile into which rows will be inserted. |
String |
spatial_reference
|
Coordinates are specified in the spatial_reference provided and converted on the fly to the coordinate system of the dataset. |
SpatialReference |
数据类型 | 说明 |
Cursor |
返回针对指定要素类、shapefile 或表的光标对象。 |
向表中插入 25 个新行。
1 import arcpy 2 3 # Create insert cursor for table 4 rows = arcpy.InsertCursor("c:/base/data.gdb/roads_lut") 5 6 # Create 25 new rows. Set the initial row ID and distance values 7 for x in xrange(1, 26): 8 row = rows.newRow() 9 row.setValue("rowid", x) 10 row.setValue("distance", 100) 11 rows.insertRow(row) 12 13 # Delete cursor and row objects to remove locks on the data 14 del row 15 del rows
原文:https://www.cnblogs.com/erickoh/p/14383154.html