關(guān)鍵詞:耕地流入流出;地類轉(zhuǎn)換;自動(dòng)分析;腳本工具;四川省中圖分類號(hào):TP311.5 文獻(xiàn)標(biāo)志碼:ADOI:10.19345/j.cnki.1674-7909.2025.07.030文章編號(hào):1674-7909(2025)7-146-8
0 引言
實(shí)現(xiàn)耕地總量動(dòng)態(tài)平衡是守住耕地保護(hù)紅線的重要手段,加強(qiáng)年度耕地流入流出管理是落實(shí)關(guān)于改革完善耕地占補(bǔ)平衡有關(guān)要求的重要舉措。耕地流人是指在分析目標(biāo)年度內(nèi),通過(guò)土地整治、建設(shè)用地增減掛鉤、高標(biāo)準(zhǔn)農(nóng)田建設(shè)等方式,將非耕地整治、復(fù)墾并轉(zhuǎn)變?yōu)楦氐倪^(guò)程;耕地流出是指在分析目標(biāo)年度內(nèi),耕地因建設(shè)占用、農(nóng)業(yè)產(chǎn)業(yè)結(jié)構(gòu)調(diào)整、自然災(zāi)毀等,轉(zhuǎn)變?yōu)槠渌r(nóng)用地、建設(shè)用地與未利用地的過(guò)程。耕地流入流出管理是耕地占補(bǔ)平衡、進(jìn)出平衡制度的進(jìn)一步延伸和拓展[1]。根據(jù)前面耕地流入流出的含義,分析縣域年度耕地流入流出就是將分析目標(biāo)年度的變更調(diào)查地類圖斑與上一年度的變更調(diào)查地類圖斑進(jìn)行疊加對(duì)比分析,然后根據(jù)分析結(jié)果統(tǒng)計(jì)耕地增加、減少2個(gè)方向的地類來(lái)源與數(shù)量,從而得到耕地在目標(biāo)年度內(nèi)面積的變化情況
目前,尚無(wú)基于四川省年度耕地流入流出管理要求的自動(dòng)分析處理方法,傳統(tǒng)方法是人工在Arc-GIS平臺(tái)上采用疊加分析功能處理數(shù)據(jù)[2],將處理結(jié)果導(dǎo)人Excel中進(jìn)行地類轉(zhuǎn)換;然后利用Excel的數(shù)據(jù)透視功能3,根據(jù)統(tǒng)計(jì)需要進(jìn)行分類匯總并單獨(dú)存表。該項(xiàng)工作涉及分析數(shù)據(jù)圖層統(tǒng)計(jì)字段的新建、地類轉(zhuǎn)換、疊加分析、數(shù)據(jù)分類匯總及分析報(bào)表輸出等主要操作流程,根據(jù)管理需要,具有重復(fù)性較高的特點(diǎn)。根據(jù)《國(guó)土空間調(diào)查、規(guī)劃、用途管制用地用海分類指南》中第三次全國(guó)國(guó)土調(diào)查(以下簡(jiǎn)稱“國(guó)土三調(diào)”工作分類一級(jí)類、《中華人民共和國(guó)土地管理法》“三大類\"的分類方式4進(jìn)行統(tǒng)計(jì),每次分析都需要重新建立對(duì)應(yīng)的轉(zhuǎn)換關(guān)系,人工分析處理耗時(shí)費(fèi)力。目前,詹龍圣5根據(jù)市縣國(guó)土空間規(guī)劃編制要求,進(jìn)行了“國(guó)土三調(diào)”工作分類與用地用海分類轉(zhuǎn)換方法研究;伍素貞等采用深度學(xué)習(xí)技術(shù)和人工目視解譯方法,著重研究了“國(guó)土三調(diào)\"地類與用地用海二級(jí)類批量轉(zhuǎn)換的精度和可靠性;李卓等7利用ArcGIS的空間分析功能,通過(guò)嵌入式VBScript程序,在耕地分等與地理信息相結(jié)合算法自動(dòng)化方面進(jìn)行了探索與嘗試;王露等8利用ArcPy設(shè)計(jì)了土地利用現(xiàn)狀及規(guī)劃分類統(tǒng)計(jì)的腳本工具,實(shí)現(xiàn)了土地利用現(xiàn)狀及規(guī)劃分類統(tǒng)計(jì)表的自動(dòng)生成;林蔚凱采用組合分析方法和多源數(shù)據(jù)融合方法,以ArcPy為基礎(chǔ)搭建Python腳本工具,實(shí)現(xiàn)了園地快速準(zhǔn)確的定級(jí)計(jì)算[9]。上述研究在地類轉(zhuǎn)換的方向、空間分析的對(duì)象、腳本設(shè)計(jì)的方式上各有側(cè)重,但均不能滿足四川省縣域年度耕地流入流出分析與統(tǒng)計(jì)的實(shí)際需要。鑒于此,研究基于Ar-cPy設(shè)計(jì),編寫(xiě)了一套在ArcGIS-Pro3.2上運(yùn)行的分析腳本工具,實(shí)現(xiàn)了耕地流入流出的自動(dòng)化分析。橫列按“國(guó)土三調(diào)”工作分類一級(jí)類、《中華人民共和國(guó)土地管理法》“三大類”的分類方式,豎行按鄉(xiāng)鎮(zhèn)代碼與名稱統(tǒng)計(jì)并導(dǎo)出Excel表,可以大大提高分析與統(tǒng)計(jì)的工作效率。
1 環(huán)境介紹
ArcPy是Esri公司為ArcGIS平臺(tái)提供的一個(gè)Python站點(diǎn)包,專門(mén)用于地理數(shù)據(jù)處理、分析和流程自動(dòng)化。它是ArcGIS的核心腳本工具,允許用戶通過(guò)Python腳本調(diào)用ArcGIS的豐富功能,包括數(shù)據(jù)管理、地圖制圖、空間分析和地理處理[10]。ArcPy提供了對(duì)ArcGIS地理處理工具的完整訪問(wèn)能力,用戶可以通過(guò)Python腳本調(diào)用這些工具,實(shí)現(xiàn)批量處理、自動(dòng)化工作流和復(fù)雜空間分析。此外,ArcPy還提供了豐富的模塊和類,用于處理地理數(shù)據(jù)、地圖文檔、圖層、幾何對(duì)象等。
2分析腳本工具的設(shè)計(jì)思路
2.1 數(shù)據(jù)準(zhǔn)備
2.1.1 數(shù)據(jù)圖層
分析腳本涉及的數(shù)據(jù)圖層包括縣域分析目標(biāo)年度變更調(diào)查地類圖斑(研究以2023年為分析目標(biāo)年度,即2023年DLTB,以下簡(jiǎn)稱\"target_layer\")、上一年度的變更調(diào)查地類圖斑(即2022年DLTB,以下簡(jiǎn)稱\"compare_layer\")和行政區(qū)圖層(即XZQ,以下簡(jiǎn)稱\"xzq_layer\")。
2.1.2地類轉(zhuǎn)換關(guān)系預(yù)處理
將縣域分析目標(biāo)年度變更調(diào)查地類圖斑導(dǎo)出Excel表,提取所有DLBM(地類編碼)與DLMC(地類名稱)列表,根據(jù)《國(guó)土空間調(diào)查、規(guī)劃、用途管制用地用海分類指南》中“國(guó)土三調(diào)”工作分類一級(jí)類、《中華人民共和國(guó)土地管理法》“三大類”與DLBM(地類編碼)和DLMC(地類名稱)的分類對(duì)應(yīng)情況,建立分析目標(biāo)縣域的變更調(diào)查地類轉(zhuǎn)換映射關(guān)系。
2.2腳本工具的設(shè)計(jì)思路
2.2.1 設(shè)計(jì)流程
腳本工具的設(shè)計(jì)流程如圖1所示。
2.2.2 設(shè)計(jì)流程的補(bǔ)充說(shuō)明
在target_layer、compare_layer中添加字段,并根據(jù)變更調(diào)查地類的映射關(guān)系進(jìn)行賦值,在ArcGIS中僅對(duì)現(xiàn)有圖層的屬性表進(jìn)行操作,不創(chuàng)建新的圖層文件。
在2個(gè)年度圖層中篩選的耕地與非耕地圖層作為分析過(guò)程中的臨時(shí)圖層,不單獨(dú)導(dǎo)出。
耕地與非耕地圖層在執(zhí)行相交操作時(shí),強(qiáng)調(diào)耕地圖層在前、非耕地圖層在后的原則,便于后續(xù)統(tǒng)一統(tǒng)計(jì)字段并簡(jiǎn)化代碼。
由于pivot_table函數(shù)的數(shù)據(jù)透視并不會(huì)對(duì)表格進(jìn)行橫行、縱列的合計(jì),因此需要在腳本中追加合計(jì)行列的代碼后再進(jìn)入\"pd.ExcelWriter函數(shù)寫(xiě)人Excel表\"流程。
在腳本工具運(yùn)行過(guò)程中,導(dǎo)出inflow_layer、out-flow_layer、identified_inflow_layer和identified_out-flow_layer等4個(gè)過(guò)程的圖層,用于人工校驗(yàn)?zāi)_本代碼的正確性。
3關(guān)鍵函數(shù)與代碼實(shí)現(xiàn)
3.1 導(dǎo)人模塊
腳本基于ArcPy語(yǔ)言編寫(xiě),并在ArcGIS-Pro3.2平臺(tái)上運(yùn)行,導(dǎo)入os、arcpy、pandas3個(gè)模塊。其中,os模塊主要用于與操作系統(tǒng)交互,arcpy模塊主要用于地理數(shù)據(jù)處理,pandas模塊用于數(shù)據(jù)處理和分析,如數(shù)據(jù)讀取、清洗、轉(zhuǎn)換、分組聚合、合并、時(shí)間序列處理等[]。模塊導(dǎo)入代碼如下:
import arcpy import os import pandas as pd
3.2主要流程代碼實(shí)現(xiàn)
3.2.1 獲取用戶參數(shù)
target_layer arcpy.GetParameterAsText(0)#設(shè)置分析目標(biāo)年度圖層compare_layer Σ= Σ arcpy.GetParameterAsText(1)#設(shè)置比較年度圖層xzq_layer
arcpy.GetParameterAsText(2)#設(shè)置行政區(qū)圖層output_dir Σ= arcpy.GetParameterAsText(3)#設(shè)置分析過(guò)程圖層的存放路徑output_excel_path=arcpy.GetParameterAsText(4)
#設(shè)置分析結(jié)果Excel表格存放路徑
3.2.2建立地類轉(zhuǎn)換映射關(guān)系
#根據(jù)數(shù)據(jù)準(zhǔn)備階段處理的地類映射關(guān)系,按
ArcPy字典編寫(xiě)轉(zhuǎn)換代碼mapping_dict '0101':{'YJDLBM':'01','YJDLMC':'耕地
'SDDLMC':農(nóng)用地'},'0508':{YJDLBM':'05','YJDLMC':'商業(yè)服務(wù)
業(yè)用地','SDDLMC':'建設(shè)用地'},'1207':{YJDLBM':'12','YJDLMC':'其他土地',
'SDDLMC':未利用地'},
3.2.3 添加字段與字段賦值
#為目標(biāo)年度圖層和比較年度圖層添加定義的
字段 defadd_new_fields(layers,field_defs): for layer in layers: existing_fields Σ= Σ {field.name for field in arcpy.
ListFields(layer)} forfield_name,field_type,field_lengthin
field_defs: if field_name not in existing_fields: print(f\"Adding field {field_name}to {layer}\") arcpy.AddField_management(layer, field_name,
field_type,field_length °leddash field_length) #根據(jù)DLBM字段的值給新增字段賦值 def update_fields(layer,mapping): field_names Σ= Σ [\"DLBM\", \"YJDLBM\",
\"YJDLMC\", \"SDDLMC\"] with arcpy.da.UpdateCursor(layer, field_names)
as cursor: for row in cursor: dlbm_value row[0] if dlbm_value in mapping: row[1]
mapping[dlbm_value]['YJDLBM'] row[2]
mapping[dlbm_value]['YJDLMC'] row[3] Σ= Σ mapping[dlbm_value]['SDDLMC'] cursor.updateRow(row) else: print(f\"Warning:DLBM value'{dlbm_value}'
not found in mapping dictionary. Skipping this row.\")
3.2.4篩選分析目標(biāo)年度與上一年度的耕地和非耕地代碼
文中僅列出篩選目標(biāo)年度圖層的耕地與非耕地代碼,同理篩選上一年度(以下涉及相同操作的按此執(zhí)行)。
#用QUERY篩選分析目標(biāo)年度圖層的耕地與非耕地代碼,不單獨(dú)導(dǎo)出圖層
def filter_target_layer(target_layer): query_cultivated_target \"YJDLMC Σ= Σ 耕地\"# 篩選分析目標(biāo)年耕地 cultivatedland_target_lyr Σ= Σ arcpy.MakeFeatureLayer_management(target_layer,\"cultivatedland_target_lyr\") arcpy.SelectLayerByAttribute_management(cultivatedland_target_lyr,\"NEW_SELECTION\",query_ cultivated_target) query_non_cultivated_target Σ= \"YJDLMC ? 耕 地\"#篩選分析目標(biāo)年度非耕地 non_cultivatedland_target_lyr Σ= Σ arcpy.MakeFeatureLayer_management(target_layer,\"non_cultivatedland_target_lyr\") arcpy.SelectLayerByAttribute_management(non_ cultivatedland_target_lyr,\"NEW_SELECTION\",query_non_cultivated_target) return cultivatedland_target_lyr,non_cultivatedland_target_lyr
3.2.5 獲取耕地流入流出圖層
3.2.5.1 獲取耕地流人圖層(inflow_layer)
#特力價(jià)口協(xié)牛反圖云時(shí)析地工 #將分析目標(biāo)年度圖層的耕地與上一年度圖層 中反圖云的非耕地相交并導(dǎo)出圖層
defcalculate_inflow_layer(cultivatedland_target_
lyr,non_cultivatedland_compare_lyr,output_shape
file): inflow_layer Ψ= Ψ os.path.join(output_shapefile,\"in
flow_layer.shp\") print(f\"Calculatinginflow layer:{inflow_layer}\") arcpy.Intersect_analysis([cultivatedland_target_
lyr,non_cultivatedland_compare_lyr],inflow_layer) returninflow_layer
3.2.5.2 獲取耕地流出圖層(outflow_layer)
#將上一年度圖層的耕地與分析目標(biāo)年度圖層 的非耕地相交 defcalculate_outflow_layer(cultivatedland_compare_lyr,non_cultivatedland_target_lyr,output_shapefile): outflow_layer τ= τ os.path. join(output_shapefile, \"outflow_layer.shp\") print(f'Calculatingoutflowlayer:{outflow_ layer}\")
arcpy.Intersect_analysis([cultivatedland_compare _lyr,non_cultivatedland_target_lyr],outflow_layer) returnoutflow_layer
3.2.6 重算面積
為準(zhǔn)確統(tǒng)計(jì)耕地流入流出面積,重算[TBMJ]、[KCMJ]、[TBDLMJ]3個(gè)字段的面積,其中[TBMJ]采用橢球面積計(jì)算方式重算面積,[KCMJ]和[TBDLMJ]按照“國(guó)土三調(diào)\"面積計(jì)算方法重算,具體如下:
def calculate_area_and_update_fields(inflow_ layer): #計(jì)算幾何面積(橢球面積)并賦值給TBMJ字 段,保留2位小數(shù) area_field \"TBMJ\" arcpy.CalculateField_management(inflow_layer, area_field,\"round(!shape.geodesicArea!,2)\", \"PYTHON3\") #更新KCMJ、TBDLMJ字段 field_names Σ= Σ [\"TBMJ\",\"KCXS\",\"KCMJ\", \"TBDLMJ\"] try: with arcpy.da.UpdateCursor(inflow_layer, field_names)ascursor: for row in cursor: tbmj
round(row[0],2) kcmj Σ= Σ round(tbmj *row[1],2) tbdlmj Σ= Σ round(tbmj-kcmj,2) row[2] Σ= Σ kcmj row[3]
tbdlmj cursor.updateRow(row) except Exception ase: print(f\"Error updating fieldsin calculate_area_ and_update_fields:{e}\")
3.2.7 標(biāo)識(shí)行政區(qū)
使用identify分別標(biāo)識(shí)耕地流人圖層(inflow_layer)、耕地流出圖層(outflow_layer),并導(dǎo)出 標(biāo)識(shí)后的圖層(identified_inflow_layer、identified_outflow_layer),代碼如下:
#標(biāo)識(shí)耕地流入圖層(inflow_layer)
defidentify_xzq_to_layers(inflow_layer,outflow_layer,xzq_layer,output_shapefile):
identified_inflow_layer Ψ= Ψ os.path.join(output_shapefile,\"identified_inflow_layer.shp\")
print(f\"IdentifyingXZQto inflowlayer:{identi
fied_inflow_layer}\")
arcpy.analysis.Identity(inflow_layer,xzq_layer, identified_inflow_layer,join_attributes \"ALL\",cluster_tolerance
,relationship 1 = 1 \"NO_RELATIONSHIPS\")
3.2.8獲取統(tǒng)計(jì)表并進(jìn)行數(shù)據(jù)透視
3.2.8.1 獲取統(tǒng)計(jì)數(shù)據(jù)源
在目標(biāo)年度耕地流人統(tǒng)計(jì)圖層(identified_inflowlayer)和目標(biāo)年度耕地流出統(tǒng)計(jì)圖層(identi-fied_outflow_layer)的基礎(chǔ)上,以XZQDM、XZQMO為第1、2列的行標(biāo)題,統(tǒng)計(jì)耕地流入與流出的來(lái)源、去向地類。
defsummarize_tables_with_pivot(identified_in flow_layer,identified_outflow_layer):
#將DBF轉(zhuǎn)為DataFrame
field_names_inflowsource [\"XZQDM\",\"XZQMC\",\"YJDLBM_1\",\"YJDLMC_1\", \"SDDLMC_1\", \"TBDLMJ\"]#指定耕地流入來(lái)源地類統(tǒng)計(jì)字段
field_names_inflowdestination Σ= Σ [\"XZQDM\", \"XZQMC\",\"DLBM\",\"DLMC\",\"TBDLMJ\"]#指定 流入耕地二級(jí)地類統(tǒng)計(jì)字段
df_inflowsource Σ= Σ pd.DataFrame(arcpy.da.TableToNumPyArray(identified_inflow_layer, field_names_inflowsource))
df_inflowdestination Σ= Σ pd.DataFrame(arcpy. da. TableToNumPyArray(identified_inflow_layer, field_names_inflowdestination))
field_names_outflowsource [\"XZQDM\",\"XZQMC\",\"DLBM\",\"DLMC\",\"TBDLMJ\"]#指定流出 耕地二級(jí)地類統(tǒng)計(jì)字段
field_names_outflowdestination Σ= Σ [\"XZQDM\", \"XZQMC\",\"YJDLBM_1\",\"YJDLMC_1\",\"SDDLMC _1\",\"TBDLMJ\"]#指定耕地流出去向地類統(tǒng)計(jì) 字段
df_outflowsource Σ= Σ pd.DataFrame(arcpy.da.Ta bleToNumPyArray(identified_outflow_layer, field_names_outflowsource))
df_outflowdestination Σ= Σ pd.DataFrame(arcpy.da. TableToNumPyArray(identified_outflow_layer, field_names_outflowdestination))
3.2.8.2采用pivot進(jìn)行數(shù)據(jù)透視
pivot_inflowsource Ψ= Ψ df_inflowsource.pivot_ table(index [\"XZQDM\",\"XZQMC\"],columns
[\"YJDLBM_1\",\"YJDLMC_1\",\"SDDLMC_1\"],values
\"TBDLMJ\",aggfunc
sum').fillna(0)
pivot_inflowdestination Σ= Σ df_inflowdestination. pivot_table(index [\"XZQDM\",\"XZQMC\"],columns
[\"DLBM\",\"DLMC\"],value ? \"TBDLMJ\",aggfunc : = 'sum').fillna(0)
pivot_outflowsource df_outflowsource.pivot _table(index
[\"XZQDM\",\"XZQMC\"],columns
[\"DLBM\",\"DLMC\"],value \"TBDLMJ\",aggfunc
'sum').fillna(0)
pivot_outflowdestination Σ= Σ df_outflowdestination.pivot_table(index °leddash [\"XZQDM\",\"XZQMC\"],columns °leddash [\"YJDLBM_1\",\"YJDLMC_1\",\"SDDLMC_ 1\"],values \"TBDLMJ\",aggfunc
sum').fillna(0)
3.2.8.3透視表追加行列匯總合計(jì) #在透視表中追加合計(jì)列 pivot_inflowsourcel['合計(jì) pivot_inflow
source.sum(axis 1 = 1 ) pivot_inflowdestination['合計(jì) pivot_in
flowdestination.sum(axis=1) pivot_outflowsource['合計(jì) pivot_outflow
source.sum(axis 1 = 1 ) pivot_outflowdestination['合計(jì) pivot_out
flowdestination.sum(axis=1) #在透視表中增加合計(jì)行 total_row_inflowsource Σ= Σ pd.Series(pivot_in
flowsource.iloc[:,:].sum(,name=('合計(jì)',\",\")) total_row_inflowdestination Σ= Σ pd.Series
(pivot_inflowdestination.iloc[:,:].sum,name=('合計(jì)
', \",\")) total_row_outflowsource Σ= Σ pd. Series(pivot_out
flowsource.iloc[:,:].sum,name=('合計(jì)',\", \")) total_row_outflowdestination Σ= Σ pd.Series
(pivot_outflowdestination.iloc[:,:].sum,name=('合
計(jì),\",\")) #在透視表中追加合計(jì)行插入到最后 pivot_inflowsource Σ= Σ pivot_inflowsource.append
(total_row_inflowsource).sort_index(kind='merge') pivot_inflowdestination Σ= Σ pivot_inflowdestina
tion.append(total_row_inflowdestination).sort_index
(kind merge') pivot_outflowsource Σ= Σ pivot_outflowsource. ap
pend(total_row_outflowsource). sort_index(kind=
'merge') pivot_outflowdestination pivot_outflowdestina
tion.append(total_row_outflowdestination).sort_index (kind='merge')
3.2.9 匯總數(shù)據(jù)導(dǎo)出Excel
#將匯總數(shù)據(jù)導(dǎo)出Excel,存放到一個(gè)工作簿中def export_to_excel(pivot_inflowsource,pivot_inflowdestination,pivot_outflowsource,pivot_out-flowdestination,excel_path):
with pd.ExcelWriter(excel_path) aswriter:
pivot_inflowsource.to_excel(writer,sheet_name= 耕地流入地類來(lái)源情況表,index True)
pivot_inflowdestination.to_excel(writer,sheet name 流入耕地二級(jí)地類情況表,index Ψ= True)
pivot_outflowsource.to_excel(writer,sheet_name 流出耕地二級(jí)地類情況表',index
True)
pivot_outflowdestination.to_excel(writer,sheet name 耕地流出地類去向情況表',index
True)
4工具實(shí)現(xiàn)與實(shí)例驗(yàn)證
4.1 工具實(shí)現(xiàn)
在ArcGIS-Pro3.2工程目錄的工具箱中新建工具箱,在新建工具箱中新建腳本,將代碼粘貼到\"執(zhí)行”對(duì)話框中,完善“常規(guī)”“參數(shù)”對(duì)話框的設(shè)置?!皡?shù)\"設(shè)置要與代碼獲取用戶參數(shù)類型一致,設(shè)置分析目標(biāo)年度圖層、上一年度圖層、行政區(qū)圖層、分析過(guò)程圖層存放路徑、分析結(jié)果Excel表格存放路徑及名稱等5個(gè)參數(shù)。腳本工具名稱為耕地流入流出分析V1.1,界面如圖2所示。
4.2 實(shí)例驗(yàn)證
筆者測(cè)試數(shù)據(jù)為四川省某區(qū)2023年度和2022
年度變更調(diào)查數(shù)據(jù)。該區(qū)面積超過(guò) ,2023
年圖斑數(shù)量超過(guò)28萬(wàn)個(gè),2022年圖斑數(shù)量超過(guò)25萬(wàn)個(gè)。經(jīng)分析,該區(qū)2023年耕地流入圖斑8257個(gè),總面積 ;耕地流出圖斑11449個(gè),總面積
年全年實(shí)現(xiàn)耕地凈流入
○
分析腳本工具運(yùn)行時(shí)間不到 4 m i n ,輸出結(jié)果符合預(yù)期,分析結(jié)果如圖3至圖6(筆者僅對(duì)鄉(xiāng)鎮(zhèn)代碼、鄉(xiāng)鎮(zhèn)名稱進(jìn)行了虛構(gòu)與隱蔽處理,微調(diào)了統(tǒng)計(jì)字段的顯示效果)。
5結(jié)論
基于ArcPy設(shè)計(jì)的縣域耕地年度流入流出分析腳本工具,可以自動(dòng)完成分析圖層的字段新建、地類轉(zhuǎn)換賦值、面積重算、疊加分析及統(tǒng)計(jì)出表,顯著提高了分析效率。該工具在面積重算過(guò)程中扣除了田坎系數(shù),統(tǒng)計(jì)報(bào)表數(shù)據(jù)均以耕地凈流入流出面積呈現(xiàn),便于無(wú)縫銜接2個(gè)年度的耕地面積。該工具不僅可以應(yīng)用于耕地年度流入流出分析,同樣適用于跨年度的任意2個(gè)年度之間的耕地動(dòng)態(tài)變化分析,對(duì)相關(guān)從業(yè)人員具有一定的參考與應(yīng)用價(jià)值。
參考文獻(xiàn):
[1]梁健,梁婧祎.縣域“進(jìn)出平衡”耕地資源補(bǔ)充潛力分析:以重慶市巴南區(qū)為例[J.自然資源情報(bào),2024(5):25-31.
[2]李歐,安靜.基于ArcGIS疊加分析功能的國(guó)土變更調(diào)查成果研究[J.測(cè)繪與空間地理信息,2024,47(S1):142-144.
[3]丁紅利.Excel數(shù)據(jù)透視表在高校數(shù)據(jù)處理中的應(yīng)用[J].電腦知識(shí)與技術(shù),2017,13(3):67-68.
[4自然資源部.自然資源部關(guān)于印發(fā)《國(guó)土空間調(diào)查、規(guī)劃、用途管制用地用海分類指南》的
通知[EB/OL].(2023-11-22)[2025-01-22].http:// gi.m.mnr.g0v.cn/202311/t20231124_2807521.html.
[5]詹龍圣.從“三調(diào)”分類到市縣國(guó)土空間總體規(guī)劃用地用海分類轉(zhuǎn)換技術(shù)方法探索[J.智能城市,2021,7(12):1-3.
[6]伍素貞,郭舟,淳錦.省級(jí)國(guó)土三調(diào)與用地用海分類數(shù)據(jù)快速轉(zhuǎn)換技術(shù)方法探索[J.測(cè)繪標(biāo)準(zhǔn)化,2024,40(1):66-73.
[7]李卓,張檳,劉毅,等.基于ArcGIS空間分析的黑龍江省耕地分等算法自動(dòng)化的設(shè)計(jì)與實(shí)現(xiàn)[J].測(cè)繪與空間地理信息,2013,36(9):157-160.
[8]王露,盧駿.基于ArcPy的土地規(guī)劃分類統(tǒng)計(jì)腳本工具設(shè)計(jì)[J].河南科技,2023,42(9):23-26.
[9]林蔚凱.ArcPy腳本工具在園林草定級(jí)中
應(yīng)用:以新羅區(qū)園地定級(jí)為例[J].北京測(cè)繪.2024,38(12):1766-1770.
2018(3):44-46,49.
[10]李詩(shī)宇,鄧吉強(qiáng).基于ArcPy的地學(xué)數(shù)據(jù)自動(dòng)化處理與分析方法[J].科技創(chuàng)新與生產(chǎn)力,
[11]韓文煜.基于python數(shù)據(jù)分析技術(shù)的數(shù)據(jù)整理與分析研究[J].科技創(chuàng)新與應(yīng)用,2020(4):157-158.
Design of a Script Tool for Annual Inflowand Outflow Analysis of Cultivated Land at the County-Level Based on ArcPy
CHENLianhai12 JIANGLan2
1.Regional Geological Survey Brigade of Sichuan Bureauof Geology,Chengdu 61OO84,China; 2.Sichuan Tianfu Rongda Information TechnologyCo.,Ltd.,Chengdu 610213,China
Abstract: Implementing dynamic monitoring of cultivated land and strengthening the management of cultivated land inflows and outflows are important measures in cultivated land protection. Conducting annual analysis of cultivated land inflow and outflowat the county level in a timely mannercan help understand dynamic changes of cultivated land,thereby better serving the protection and management of cultivated land.In this paper,based on the policies fortheannual management of cultivated land inflows and outflows in Sichuan Province,we design and develop a script tool using ArcPy for analyzing annual changes in cultivated landat the county level.The tool,implemented on the ArcGIS Pro 3.2 platform,enables land use type conversion,automated analysis of cultivated land inflow and outflow,and area recalculation.The column headers of the output statisticaltable are subjectto data processing according to the first-level categories of the classification for the Third National Land Survey work and the \"Three Major Categories\" in the Land Administration Law.The row headers are based onthe statisticalcalibers of the townshipcodes and township names.Finally,Excel tables are respectively output according to the source and destination land categories of the inflow and outflow of cultivated land,significantly reducing repetitive tasks and improving the eficiency of analysis and statistics.
Key words: cultivated land inflow and outflow; land use type conversion; automated analysis; ArcPy-based script tool; Sichuan Province