It’s your logic that’s tripping you.
• import arcpy, os
• from arcpy import env
• from arcpy.sa import *
• arcpy.env.overwriteOutput = True
•
• env.workspace = arcpy.GetParameterAsText(0)
• out = arcpy.GetParameterAsText(1)
• fc = arcpy.ListFeatureClasses("Pnt*", "Point")
• ras = arcpy.ListRasters("dem*", "GRID")
• point = "Pntclip_pol1"
• dem = "dempol1"
• i = 1
• for shp in fc: <<< First time in loop this is Pntclip_pol1???? 2nd time it’s Pntclip_pol2 ??
If it’s Pntclip_pol1 why did you define it?? It’s the first item in your fc list.
• for raster in ras: first time it’s dempol1?? Is that also the first item in your dem list?
• # if (shp == point and raster == dem): ???WHY??? Not needed..
• #inRaster = raster # not needed
• # inObserverFeatures = shp #not needed
• #outViewshed = Viewshed(inRaster, inObserverFeatures, "")
outViewshed = Viewshed(raster, shp)
• outViewshed.save(out + "
" + "view" + str(i))
• i = i + 1 #already an int as declared above..
• #point = "Pntclip_pol" + str(i)
• # dem = "clippol" + str(i)
Just say you have 3 points and 5 dems
For i in pointlist:
For dem in demlist:
theViewshed = viewshed(dem, i)
the Viewshed.save (xxxxxx+ str(1))
Here the loop would use the same i and run through the next dem
Once finished it would loop the next i and toss you back into the dem loop
1 pt
1 dem
Viewshed (1 dem, 1 pt)
Now loop
2 dem
Viewshed( 2 dem, 1 pnt)
Now loop
3 dem
Viewshed( 3 dem, 1 pt)
Now loop
Etc.. until finished with dems then kick to 2nd point
2 pt
1 dem
Viewshed (1 dem, 2 pt)
Now loop
2 dem
Viewshed( 2 dem, 2 pnt)
Now loop
3 dem
Viewshed( 3 dem, 2 pt)
Now loop
You don’t need to name the items in each list as they will always advance to the next item in each list.
Leave i =1 and have I = i+1 inside the dem loop so your new views are numbered..