zoukankan      html  css  js  c++  java
  • arcgis python 开启编辑会话和编辑操作、在表中创建行、停止编辑操作以及提交编辑会话。

    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, ('SHAPE@', '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)
    ========================================================帮助写错,本人修改如下
    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)
    edit.startEditing(False, True) #写在前面,gisoracle
    # Start an edit operation
    edit.startOperation()
    
    
    
    # Insert a row into the table.
    with arcpy.da.InsertCursor(fc, ('SHAPE@', '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)




  • 相关阅读:
    c++ stl vector的push_back和emplace_back
    整数模n加法群和乘法群
    分享一下 jpeg的压缩算法总结
    利用位运算转换大小写
    java 作业题8
    java 作业题7
    uni-app开发经验分享二十二: uni-app大转盘思路解析
    微信小程序、微信公众号、H5之间相互跳转
    JS闭包的理解
    js原型详解
  • 原文地址:https://www.cnblogs.com/gisoracle/p/11382169.html
Copyright © 2011-2022 走看看