AnsweredAssumed Answered

Problem with If , For statements

Question asked by kostas_ptr88 on Nov 23, 2015
Latest reply on Dec 1, 2015 by bill@poconogis.com

Hello I have created this code to run a number of viewsheds for a group of points shp Pnt1, Pnt2... and a group of  Dems, dem1, dem2 etc. For some reason I don't have any results but I don't know why. This is the code:

 

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:
    for raster in ras:
        if (shp == point and raster == dem):
            inRaster = raster
            inObserverFeatures = shp
            outViewshed = Viewshed(inRaster, inObserverFeatures, "")
            outViewshed.save(out + "\\" + "view" + str(i))
            i = int(i) + 1
            point = "Pntclip_pol" + str(i)
       dem = "clippol" + str(i)

Outcomes