写arcpy一个土地利用分类表
时间: 2024-05-03 15:21:40 浏览: 11
以下是一个用arcpy编写的土地利用分类表的示例:
```
import arcpy
# 设置工作空间
arcpy.env.workspace = "C:\data"
# 创建一个新的表格
table = arcpy.CreateTable_management("C:\data", "LandUseTable")
# 添加字段
arcpy.AddField_management(table, "LandUseType", "TEXT")
arcpy.AddField_management(table, "Description", "TEXT")
# 添加数据
cursor = arcpy.da.InsertCursor(table, ["LandUseType", "Description"])
cursor.insertRow(["Residential", "Land used for housing"])
cursor.insertRow(["Commercial", "Land used for businesses"])
cursor.insertRow(["Industrial", "Land used for factories or warehouses"])
cursor.insertRow(["Agricultural", "Land used for farming"])
cursor.insertRow(["Forest", "Land used for timber"])
cursor.insertRow(["Water", "Land used for bodies of water"])
cursor.insertRow(["Recreational", "Land used for parks or recreation"])
cursor.insertRow(["Other", "Land used for other purposes"])
# 关闭游标
del cursor
# 打印完成信息
print("Land use classification table created successfully.")
```