使用python脚本的ArcGIS自定义工具箱,使用用户输入的字段名和对应的别名列表,可以一次更新大量的字段别名。假设你有一个ArcGIS特性类或表,它有一堆模糊的、缩写的字段名,你想添加别名以使它们更容易理解。假设您还有一个字段名和对应的别名列表,您已经在Excel或其他工具中准备好了。您所需要做的就是将该列表保存为一个CSV文件,字段名在第一列,别名在第二列。然后运行该工具。惟一需要的输入是特性类和CSV文件。脚本使用arcpy和csv包。它首先读取CSV文件并将其解析为一个python列表,其中列表中的每个项都是包含字段名和别名值的列表。然后,它遍历该列表,运行arcpy命令,尝试更新列表中每个字段名的别名。在工具运行时,它将为每个获得更新别名的字段显示一条消息。 If a field name from your list does not exist in the feature class, the tool will display a message telling you that and move on to the next one. It should take just a few seconds per field to run. I ran this tool successfully with ArcGIS Desktop 10.5. I believe it could also be tweaked to work on a shapefile instead of a feature class. It’s really a pretty simple script, and I’m probably not the first person to come up with something like this, but I couldn’t find a solution searching elsewhere. Please let me know or suggest changes if it doesn’t work for you.
...查看更多