我正在编写一个python脚本来添加字段并将数据写入ArcGIS表。我可以成功地编辑和删除表中的列或字段。但我一直在把数据写进字段。我有一个代码,我们可以通过它来获得类型和其他有关字段的信息。但我无法在这个领域写点东西。你知道吗
这是我从他们论坛得到的剧本-
import arcpy
feature_class = "c:/data/counties.shp"
# Create a list of fields using the ListFields function
fields = arcpy.ListFields(feature_class)
# Iterate through the list of fields
for field in fields:
# Print field properties
print("Field: {0}".format(field.name))
print("Alias: {0}".format(field.aliasName))
print("Type: {0}".format(field.type))
print("Is Editable: {0}".format(field.editable))
print("Required: {0}".format(field.required))
print("Scale: {0}".format(field.scale))
print("Precision: {0}".format(field.precision))
我的主键是COPROPCD,我想根据另一个具有公共主键的数据集更改其他字段。你知道吗
要更新记录,需要使用UpdateCursor方法。假设你的
datasource
是一个字典,你可以这样做相关问题 更多 >
编程相关推荐