POST
|
Problem solved import arcpy, os
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("Spatial")
#arcpy.env.workspace = arcpy.GetParameterAsText(0)
arcpy.env.workspace = "C:/Results/ArcMap/Visibility/Calc_View"
ink = arcpy.env.workspace
fc = arcpy.ListFeatureClasses("Pn*", "Point")
ras = arcpy.ListRasters("cl*", "GRID")
i = 0
for seip in fc:
i= i + 1
demi = "clpol" + str(i)
vect = "Pnclpol" + str(i) + ".shp"
for rast in ras:
if (seip == vect and rast == demi):
outViewshed = Viewshed(rast, seip)
outViewshed.save("C:/Results/ArcMap/Visibility/Calc_View/View" + str(i)) Error 010004 is very hard to get away and I confirm as in the post Raster NoDATA Value Error 010004 Driving me crazy! that renaming your files may be a solution to the problem also.
... View more
11-26-2015
02:56 AM
|
1
|
1
|
1626
|
POST
|
Well manually it works perfectly but with the script I have no idea why not. I did a search and I saw that that error is usual and it doesn't have a logic in many circumstances. I have sent you 5 pairs of rasters and shp to try it if you have the time, because I don't think I am doing something wrong, this error is very strange and I believe propably has to do with the software.
... View more
11-26-2015
01:18 AM
|
0
|
0
|
866
|
POST
|
I tried it Mr. Chappell but I only get back two viewsheds and then I have again the same error
... View more
11-25-2015
01:14 PM
|
0
|
2
|
866
|
POST
|
I will check it out also but the previous code returned me only Pointclippol1 & Pnt1, Pointclippol1 & Pnt2 and then again the same error.
... View more
11-25-2015
12:58 PM
|
0
|
0
|
506
|
POST
|
Ok I developed the code at that form but I have an error of ERROR 010004: All cells in Raster clippol1 have the NODATA value. Stop execution. ERROR 010067: Error in executing grid expression. Failed to execute (Viewshed). This is the code where I tried to define extent also but I get back only one viewshed and not with the coding I want (line 11). And these errrors keep appear, I extracted these rasters from Modelbuilder I haven't set anything to NODATA so as to have problem import arcpy, os
from arcpy import env
from arcpy.sa import *
ink = "C:/DEFENCE_DATA/Results/ArcMap/Visibility/Calc_View"
fc = arcpy.ListFeatureClasses("Pnt*", "Point")
demi = "clippol1"
i = 1
for seip in fc:
arcpy.env.extent = ink + "/clippol" + str(i)
outViewshed = Viewshed(demi, seip)
outViewshed.save(ink + "/view" + str(i))
i = i + 1
dem = "clippol" + str(i) I think that I am very close to finally make it run but I have to solve that with NODATA
... View more
11-25-2015
03:04 AM
|
0
|
4
|
866
|
POST
|
Ok I understand you now. Well at your question, I define point and dem because each dem has only one specific point. Dem 1 has only point 1, dem2 has only point 2 etc..
... View more
11-25-2015
01:53 AM
|
0
|
3
|
506
|
POST
|
The model can run only if I have define the inputs from inside the model and not if I have erased the inputs outputs so as to be white like here.
... View more
11-25-2015
12:36 AM
|
0
|
0
|
256
|
POST
|
That's a very analytic answer Mr Chappell, thank you very much. I will study the code and I will reply you.
... View more
11-23-2015
04:06 PM
|
0
|
0
|
506
|
POST
|
Haha, thank god you noted that, I was totally exhausted by a different problem, I corrected the question.
... View more
11-23-2015
04:01 PM
|
0
|
0
|
256
|
POST
|
I don't think I fully understand you, I am seeing many errors in the code, it would be better if you could put it in Python context. for example outViewshed.save(mypath"view" str(count)) here it should be (mypath + "view" + str(count)) count = count + int(1) point = Pnta + str(1) Unfortunately my code isn't right as well I can get only one Viewshed
... View more
11-23-2015
10:35 AM
|
0
|
6
|
506
|
POST
|
Hello, I have a dem from which I am trying to create 9 separate smaller dems via clip Raster based on 9 polygons. The problem is that I cannot get all the 9 clipped dems but only 2 and I don't know the reason. This is the model I have Ο χρήστης KON PETROV επεξεργάστηκε το μήνυμα.
... View more
11-23-2015
10:10 AM
|
0
|
3
|
3172
|
POST
|
Because after the first pair of Point (Pntclip_pol1) and Dem (dempol1) I want to do the viewshed for Pntclip_pol2 and dempol2 etc 3,4,5..
... View more
11-23-2015
09:25 AM
|
0
|
15
|
506
|
POST
|
I corrected the code as much as I could in that form. But unfortunately i cannot get the 1st pair for the 1st point (Pntclip_pol1) and 1st dem (dempol1) and then rest of them 2,3,4 for some reason. I get only one viewshed import arcpy, os from arcpy import env from arcpy.sa import * arcpy.env.overwriteOutput = True #env.workspace = "c:/DEFENCE_DATA/Results/ArcMap/Visibility/Calc_View" env.workspace = arcpy.GetParameterAsText(0) out = arcpy.GetParameterAsText(1) fc = arcpy.ListFeatureClasses("Pnt*", "Point") ras = arcpy.ListRasters("dem*", "GRID") point = "Pntdempol1.shp" dem = "dempol1" i = 1 for seip in fc: for rakster in ras: if (seip == point and rakster == dem): inRaster = rakster inObserverFeatures = seip outViewshed = Viewshed(inRaster, inObserverFeatures, "") outViewshed.save(out + "\\" + "view" + str(i)) i = int(i) + 1 point = "Pntdempol" + str(i) dem = "dempol" + str(i)
... View more
11-23-2015
09:22 AM
|
0
|
0
|
760
|
POST
|
ok first of all I must have my data in a folder and not in a folder inside the other folder* of course
... View more
11-23-2015
08:41 AM
|
0
|
0
|
760
|
POST
|
I did that but print works only after the first loop. If I put the second for loop I don't have any result. My task is to use for the viewsheds first the Pnt1 with Dem1 then Pnt2 with Dem2 etc. If you have any other suggestion that would be welcomed.
... View more
11-23-2015
08:11 AM
|
0
|
19
|
760
|
Title | Kudos | Posted |
---|---|---|
1 | 04-05-2015 02:15 PM | |
1 | 12-16-2015 03:56 AM | |
1 | 11-26-2015 02:56 AM | |
1 | 04-03-2015 08:39 AM | |
1 | 02-26-2016 02:24 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|