在国土管理日常统计工作中经常需要用到三大类数据(农用地、建设用地、未利用地),而三调数据库中无三大类字段,因此需要手工录入三大类字段,并根据二级地类代码录入相关三大类名称。本代码可一键录入海量三大类名称统计工作。方法如下:
打开数据库文件的属性表,添加三大类字段,打开字段计算器,如下图:
接下来是核心代码,采用了VB中的select case 语句 :
Dim density
''二级类转三大类:by qq:443440204
''说明:此代码按土地报批要求,043 和0404 荒草地归类为农用地,如依据三调工作分类,需手工更正到
select case [DLBM]
case "012"
density ="农用地"
case "013"
density= "农用地"
case "021"
density= "农用地"
case "023"
density= "农用地"
case "031"
density= "农用地"
case "033"
density= "农用地"
case "104"
density= "农用地"
case "114"
density= "农用地"
case "117"
density= "农用地"
case "122"
density= "农用地"
case "043"
density= "农用地"
case "201"
density= "建设用地"
case "202"
density= "建设用地"
case "203"
density= "建设用地"
case "204"
density= "建设用地"
case "205"
density= "建设用地"
case "101"
density= "建设用地"
case "102"
density= "建设用地"
case "113"
density= "建设用地"
case "118"
density= "建设用地"
case "111"
density= "未利用地"
case "116"
density= "未利用地"
case "125"
density= "未利用地"
case "0102"
density ="农用地"
case "0103"
density= "农用地"
case "0201"
density= "农用地"
case "0204"
density= "农用地"
case "0301"
density= "农用地"
case "0305"
density= "农用地"
case "0307"
density= "农用地"
case "1006"
density= "农用地"
case "1103"
density= "农用地"
case "1104"
density= "农用地"
case "1104A"
density= "农用地"
case "1107"
density= "农用地"
case "1107A"
density= "农用地"
case "1202"
density= "农用地"
case "05H1"
density= "建设用地"
case "0508"
density= "建设用地"
case "0601"
density= "建设用地"
case "0602"
density= "建设用地"
case "0701"
density= "建设用地"
case "0702"
density= "建设用地"
case "08H1"
density= "建设用地"
case "08H2"
density= "建设用地"
case "08H2A"
density= "建设用地"
case "0809"
density= "建设用地"
case "0810"
density= "建设用地"
case "0810A"
density= "建设用地"
case "09"
density= "建设用地"
case "1001"
density= "建设用地"
case "1002"
density= "建设用地"
case "1003"
density= "建设用地"
case "1004"
density= "建设用地"
case "1005"
density= "建设用地"
case "1109"
density= "建设用地"
case "1201"
density= "建设用地"
case "0404"
density= "农用地"
case "1101"
density= "未利用地"
case "1106"
density= "未利用地"
case "0302"
density= "农用地"case else
density= "1错误"
end select
确定即可生成三大类代码。
同理,生成一级类通用代码如下 :
selectcase 语句
Dim density
''二级类转一级类:by qq:443440204
select case left( [DLBM] ,2)
case "01"
density ="耕地"
case "02"
density ="园地"
case "03"
density ="林地"
case "04"
density ="草地"
case "05"
density ="商业服务业用地"
case "06"
density ="工矿用地"
case "07"
density ="住宅用地"
case "08"
density ="公共管理与公共服务用地"
case "09"
density ="特殊用地"
case "10"
density ="交通运输用地"
case "11"
density ="水域及水利设施用地"
case "12"
density ="其他土地"
case "00"
density ="湿地"
case "20"
density ="城镇村及工矿用地"
case else
density ="1错误"
end select
if else 语句显得比较啰嗦,也一并附上:
Dim density
Dim fz
fz=left( [DLBM] ,2)if fz ="01"Then
density ="耕地"
elseif fz ="02"Then
density ="园地"
elseif fz ="03"Then
density ="林地"
elseif fz ="04"Then
density ="草地"
elseif fz ="05"Then
density ="商业服务业用地"
elseif fz ="06"Then
density ="工矿用地"
elseif fz ="07"Then
density ="住宅用地"
elseif fz ="08"Then
density ="公共管理与公共服务用地"
elseif fz ="09"Then
density ="特殊用地"
elseif fz ="10"Then
density ="交通运输用地"
elseif fz ="11"Then
density ="水域及水利设施用地"
elseif fz ="12"Then
density ="其他土地"
elseif fz ="00"Then
density ="湿地"
elseif fz ="20"Then
density ="城镇村及工矿用地"
elsedensity =null
end if