||
首先在arcgis中打开python工具,引入“arcpy”库
import arcpy
而后添加字段“GHDLMC”,长度为20
arcpy.AddField_management("DLTB","GHDLMC","TEXT",field_length=20,field_is_nullable="NULLABLE")
根据地类分类,进行匹配、汇总,构建规则
codeb=''' ... def fill(a): ... if a == u"旱地" or a == u"水浇地" or a == u"水田": ... return "耕地" ... elif a == u"天然牧草地" or a == u"人工牧草地": ... return "草地" ... elif a == u"农村道路" or a == u"设施农用地"or a == u"坑塘水面"or a == u"田坎"or a == u"沟渠": ... return "其他农用地" ... elif a == u"乔木林地" or a == u"灌木林地"or a == u"其他林地": ... return "林地" ... elif a == u"天然牧草地" or a == u"人工牧草地": ... return "草地" ... elif a == u"果园" or a == u"茶园" or a == u"其他园地": ... return "园地" ... elif a == u"河流水面" or a == u"水库水面" or a == u"湖泊水面": ... return "水域" ... elif a == u"森林沼泽" or a == u"灌丛沼泽" or a == u"沼泽草地"or a == u"内陆滩涂"or a == u"沼泽地"or a == u"沼泽草地": ... return "湿地" ... elif a == u"其他草地" or a == u"冰川及永久积雪" or a == u"盐碱地"or a == u"沙地"or a == u"裸土地"or a == u"裸岩石砾地": ... return "自然荒野土地" ... else: ... return "待核实" ... '''
开始字段索引、计算
arcpy.CalculateField_management("DLTB","GHDLMC","fill(!DLMC!)","PYTHON_9.3",codeb)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-1-7 17:11
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社