|
利用arcpy, Python编码给要素图层增加属性字段
实例代码如下:
import arcpy featureClass = r"C:\Users\Administrator\Desktop\WorkData\TestData\ArcPython\testGDB\Test.gdb\Line" lineList = ["N1234", "Text", "50"] try: if arcpy.Exists(featureClass): arcpy.AddField_management(featureClass, lineList[0], lineList[1], lineList[2]) print "OK" else: print "feature is not exist" except Exception as e: print "Failed" print e.message
顺带说一下,在测试过程中,在使用ArcMap或Python中,有时会遇到Error 000464的报错。
报错详情:
Error 000464 : 无法获取独占方案锁。正被编辑或正在被其他应用程序使用。
ExecuteError: ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application.Failed to execute (JoinField).
描述:
多个用户可以同时读取和编辑相同数据。为了能够使用数据,应用程序必须能够假定该方案已固定并且在使用其内容的任何时候都不会发生更改。
解决方案:
请检查您是否正在独占使用和编辑数据集,关闭ArcMap,看错误是否解决
如果错误还未解决,打开任务管理器将有关ArcGIS的程序关闭。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-4-24 18:36
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社