arcgis python 开启编辑会话和编辑操作、在表中创建行、停止编辑
发布时间:2020-12-20 10:55:45 所属栏目:Python 来源:网络整理
导读:import arcpy import osfc = ‘ Database Connections/Portland.sde/portland.jgp.schools ‘ workspace = os.path.dirname(fc) # Start an edit session. Must provide the worksapce. edit = arcpy.da.Editor(workspace) # Start an edit operation edit.s
import arcpy import os fc = ‘Database Connections/Portland.sde/portland.jgp.schools‘ workspace = os.path.dirname(fc) # Start an edit session. Must provide the worksapce. edit = arcpy.da.Editor(workspace) # Start an edit operation edit.startOperation() # Edit session is started without an undo/redo stack for versioned data # (for second argument,use False for unversioned data) edit.startEditing(False,True) # Insert a row into the table. with arcpy.da.InsertCursor(fc,(‘[email?protected]‘,‘Name‘)) as icur: icur.insertRow([(7642471.100,686465.725),‘New School‘]) # Stop the edit operation. edit.stopOperation() # Stop the edit session and save the changes edit.stopEditing(True) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |