python调用arcgis功能一例
执行方法:
D:\data\python>python test_Select.py
window11下环境变量设置
此电脑/属性/系统/高级系统设置/高级/环境变量/path
path中添加全局目录:C:\Python27\ArcGIS10.4
test_Select.py脚本内容
# Name: Select_Example2.py
# Description: Select roads of Class 4 from major roads tin the gnatcatcher habitat study area# Import system modules
import arcpy
from arcpy import env# Set workspace
env.workspace = "D:\data\python\shp"# Set local variables
in_features = "DLTB2021.shp"
where_clause = '"DLBM" = \'0101\''# create gdb file
arcpy.CreateFileGDB_management("D:/data/python/shp/output","dltb.gdb")out_feature_class = "D:/data/python/shp/output/dltb.gdb/dltb_0101"# Execute Select
arcpy.Select_analysis(in_features, out_feature_class, where_clause)# execute .py script out result python test_Select.py
—the—end—