打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
在Zonal Statistics工具中使用重叠的区
 Howto: 在Zonal Statistics工具中使用重叠的区
文章编号: 39516
软件:  ArcGIS - ArcEditor 9.3, 9.3.1, 10 ArcGIS - ArcInfo 9.3, 9.3.1, 10 ArcGIS - ArcView 9.3, 9.3.1, 10
操作系统: N/A
摘要:
提供的脚本用于对相互重叠的区进行Zonal Statistics计算。
当使用多边形要素作为Zonal Statistics工具的区时,该工具会将多边形要素栅格化。如果多边形要素存在的重叠,栅格化会导致数据丢失。
Zonal Statistics中的这一缺陷,可以通过使用python逐一处理单个要素来解决。
内容:
# 导入系统模块
import arcgisscripting, os
# 创建Geoprocessor对象
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1
# 检查许可
gp.CheckOutExtension("Spatial")
#设置默认工作空间
gp.workspace = "C:/Data"
# 设置变量
raster = "measurements.tif"
inFC = "zone_features.shp"
outTable = "zonal_stats.dbf"
DBF_dir = "dbf" #folder for temp dbf outputs
if not os.path.exists(DBF_dir):
os.mkdir(DBF_dir)
#循环处理要素
inRows = gp.searchcursor(inputFC)
inRows.reset()
inRow = inRows.next()
while inRow:
# Zone_ID is the assumed name of the zone field
print "{0} is being processed".format(inRow.Zone_ID)
lyr = "Zone {0}".format(inRow.Zone_ID)
gp.MakeFeatureLayer_management(inFC, lyr, '"FID" = {0}'.format(inRow.FID))
tempTable = "{0}/DBF_{1}.dbf".format(DBF_dir, inRow.Test)
gp.ZonalStatisticsAsTable_sa(lyr, "Zone_ID", raster, tempTable, "DATA")
inRow = inRows.next()
#设置临时DBF文件的存储路径
gp.workspace = DBF_dir
TableList = gp.ListTables("*")
#合并临时DBF文件
gp.Merge(TableList, outTable)
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ArcGIS栅格统计方法总结
伟世通:Zonal架构下的思考
ArcGis中如何将点所在的面的信息赋值到点中?
怎么来解决GIS表转Excel超了65535的最大行限制
Has ISKCON Lost Romapada's Entire Zone?
使用ArcGIS一定要掌握的神技巧
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服