我想运行使用地理处理工具的 python 脚本。我不想集成它们,而是想在外部而不是在 ArcGIS 中运行脚本。请用一个很好的例子告诉我如何做到这一点。我必须对 4 个地图进行重新分类,然后对输出进行加权和叠加。下面是我能写的脚本,但我不知道我在哪里出错了..
enter code here #
import sys, string, os, arcgisscripting
gp = arcgisscripting.create()
gp.CheckOutExtension("spatial")
gp.AddToolbox("C:/../Spatial Analyst Tools.tbx")
feature_shp1 = sys.argv[1]
if feature_shp1 == '#':
feature_shp1 = "D:\\BRIEFCASE\\media\\new shapefiles\\feature_shp1"
slope = sys.argv[2]
if slope == '#':
slope = "D:\\"
Reclassification__2_ = sys.argv[3]
if Reclassification__2_ == '#':
Reclassification__2_ = "2 1;2 3 2;3 4 3;4 5 4"
Reclassification = sys.argv[4]
if Reclassification == '#':
Reclassification = "0 13 1;13 45 2;45 80 3;80 108 4;108 146 5;146 176;174 195 7;195 231 8;231 255 9"
Reclass_feat3 = "D:\\"
Reclass_slop3 = "D:\\3"
gjh = "C:\"
Reclass_field = "VALUE"
Reclass_field__2_ = "VALUE"
gp.Reclassify_sa(feature_shp1, Reclass_field__2_, Reclassification__2_, Reclass_feat3, "NODATA")
gp.Reclassify_sa(slope, Reclass_field, Reclassification, Reclass_slop3, "NODATA")
gp.WeightedSum_sa("'..Reclass_feat3' VALUE 1;'D:..Reclass_slop3' VALUE 1","ijh")