首页 > 其他 > 详细

ArcPy函数-插入游标InsertCursor

时间:2021-02-06 23:56:59      阅读:93      评论:0      收藏:0      [点我收藏+]

ArcGIS 帮助 10.2

摘要

向要素类、shapefile 或表中插入行。InsertCursor 返回一个分发行对象的枚举对象。

讨论

可使用 newRow 方法从插入行的枚举对象获取新的行对象。每次调用光标上 insertRow 都会在表中创建新行,该行的初始值设置为输入行中的值。

语法

InsertCursor (dataset, {spatial_reference})
参数 说明 数据类型
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 或表的光标对象。

代码实例

InsertCursor 示例

向表中插入 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

 

ArcPy函数-插入游标InsertCursor

原文:https://www.cnblogs.com/erickoh/p/14383154.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!