1. 创建Feature Class。
//新建Feature类
Create_Feature_Class()
2. Add Field。
# Name: AddField_Example2.py # Description: Add a pair of new fields to a table # Import system modules import arcpy from arcpy import env # Set environment settings env.workspace = "C:/data/airport.gdb" # Set local variables inFeatures = "schools" fieldName1 = "ref_ID" fieldPrecision = 9 fieldAlias = "refcode" fieldName2 = "status" fieldLength = 10 # Execute AddField twice for two new fields arcpy.AddField_management(inFeatures, fieldName1, "LONG", fieldPrecision, "", "", fieldAlias, "NULLABLE") arcpy.AddField_management(inFeatures, fieldName2, "TEXT", "", "", fieldLength)
右键ArcToolbox查看Help里有:
3. 创建domain。
import arcpy try: # Set the workspace (to avoid having to type in the full path to the data every time) arcpy.env.workspace = r'Database Connections\Connection to wuhan.sde' # Set local parameters domName = "管道层级" gdb = r'Database Connections\Connection to wuhan.sde' inFeatures = r'Database Connections\Connection to wuhan.sde\sss.SDE.排水管' inField = "Pipe_Level" # Process: Create the coded value domain arcpy.CreateDomain_management(gdb, domName, "按管道层级", "SHORT", "CODED") #Store all the domain values in a dictionary with the domain code as the "key" and the #domain description as the "value" (domDict[code]) domDict = {"1":"入户线", "2": "支线", "3": "干线", \ "4": "主干线"} # Process: Add valid material types to the domain #use a for loop to cycle through all the domain codes in the dictionary for code in domDict: arcpy.AddCodedValueToDomain_management(gdb, domName, code, domDict[code]) # Process: Constrain the material value of distribution mains arcpy.AssignDomainToField_management(inFeatures, inField, domName) except Exception as err: print(err.args[0])
>>在服务器端操作时上面的连接sde的字符串也可能是
Database Connections\wuhan.sde
在服务器端赋域给属性时要注意先停止服务。
4. 将Domain赋值给属性
//Assign Domain to field
5. 为属性添加Alias
》》
1.比对属性是否相同。-->Excel
2.备份线上的数据库。
3.更新现在的数据库。
4.上传到线上数据库。
5.编写文档。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2020-01-06 python detect.py
2018-01-06 斯坦福大学公开课 机器学习
2018-01-06 斯坦福大学公开课 视觉识别卷积神经网络