Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to create python script with aim to import him in environment arcmap 10.1 and to make a hydrologic analysis

because the scipt meybe can have many outputs raster file or feature class would like to find a way for automatic save outputs variables in the folder workspace

for example

I want to import a raster file (Dem) and to take as export a 3 raster file from the command fill sinks, Fill Sinks,flow directions and flow accumulation from arc hydro toolbox

cl = my import dem fill = output for Fill Sinks fdr = output for flow directions Fac = output for flow accumulation and i want export them(3 raster) automatically saved to the folder workspace without definitive output parameters from the user

import arcpy

arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")

# Local variables:
arcpy.CheckOutExtension("spatial")
arcpy.env.overwriteOutput = True
arcpy.env.workspace = arcpy.GetParameterAsText(0)
cl = arcpy.GetParameterAsText(1)
# Process: Fill Sinks
arcpy.FillSinks_archydrotools(cl, fill, "", "", "ISSINK_YES")
# Process: Flow Direction
arcpy.FlowDirection_archydrotools(fill, Fdr, "")
# Process: Flow Accumulation
arcpy.FlowAccumulation_archydrotools(Fdr, Fac)

any idea ?

share|improve this question

1 Answer 1

From what I understand, you just have to assign fill, Fdr and Fac the name you want to name those raster! They will be automatically saved to the arcpy.env.workspace.

import arcpy

arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")

#Set Ouput Names
fill=arcpy.GetParameterAsText(0) + '\\OuputFillRasterName'
Fdr=arcpy.GetParameterAsText(0) + '\\OuputFdrRasterName'
Fac=arcpy.GetParameterAsText(0) + '\\OuputFacRasterName'

# Local variables:
arcpy.CheckOutExtension("spatial")
arcpy.env.overwriteOutput = True
arcpy.env.workspace = arcpy.GetParameterAsText(0)
cl = arcpy.GetParameterAsText(1)
# Process: Fill Sinks
arcpy.FillSinks_archydrotools(cl, fill, "", "", "ISSINK_YES")
# Process: Flow Direction
arcpy.FlowDirection_archydrotools(fill, Fdr, "")
# Process: Flow Accumulation
arcpy.FlowAccumulation_archydrotools(Fdr, Fac)
share|improve this answer
    
yes I want that but your exaple not running...i show me error message failed to execute (scipt) –  user27818 Mar 12 at 17:22
    
Hey.. I haven't tested this with archydrotools... But I have changed the variables assignment to something that should work... See edits in answer. –  jeb Mar 12 at 19:38
    
yes it work thank you very much,you are my best friend thank you –  user27818 Mar 12 at 22:55
1  
If this answer solved your problem, you should accept it, so others will known that this was useful. –  jeb Mar 14 at 17:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.