I'm getting use FillSinks by ArcHydroTools but some problems are happen.

I use this code:

import arcpy
import ArcHydroTools
from arcpy import env
ws = env.workspace = r"C:\Users\fractal\Desktop\python_teste\projecaoMiriab2.tif"
output = "C:\Users\fractal\Documents\ArcGIS\Layers"
ArcHydroTools.FillSinks(ws, output)

and this error appears:

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Raster Layer. Failed to execute (FillSinks).

I already tried to change my raster to format .lyr but it doesn't work.

What should I do?

  • Have you tried creating a Raster Layer from your tiff and using that as the input? arcpy.MakeRasterLayer_management (in_raster, out_rasterlayer, {where_clause}, {envelope}, {band_index})
    – Brian
    Apr 22 '19 at 17:22
  • I tried and didn't work too.. Apr 22 '19 at 18:40
  • Don't forget to take the Tour to learn about our focused Q&A format. Please use the edit button to revise your question with any requested clarifications.
    – PolyGeo
    Apr 22 '19 at 20:15

This is a bit wonky:

ws = env.workspace = r"C:\Users\fractal\Desktop\python_teste\projecaoMiriab2.tif"

This code assigns the workspace, and the variable ws, to the folder housing your tif. So this line of code:

ArcHydroTools.FillSinks(ws, output)

tries to run the hydro tool with a folder as an input for a raster.

Your output looks like a folder. If so, add the name of your output raster to the output variable.

output = "C:\Users\fractal\Documents\ArcGIS\Layers\OutRaster"

A raster layer is different from a layer file, which you indicated when mentioning .lyr.

Use Make Raster Layer.

rast = r"C:\Users\fractal\Desktop\python_teste\projecaoMiriab2.tif"
arcpy.MakeRasterLayer_management(rast, "Miri")
ArcHydroTools.FillSinks("Miri", output)
  • I did it and another error appeared.. Apr 22 '19 at 18:07
  • The another error is: Apr 22 '19 at 18:07
  • arcgisscripting.ExecuteError: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel) at ESRI.APWR.ApHydro.ArcHydroOp.FillSinks(ApLayers& aplayers, Boolean useIsSink, Boolean fillAll, Double fillLimit, ITrackCancel trackCancel, IGPMessages messages, String& exMessage) in C:\Builds\HydroSolutions\10.2_ArcHydro\Sources\ArcHydroTools\src\ApHydro\ArcHydroOp.vb:line 64688 Failed to execute (FillSinks) Apr 22 '19 at 18:07
  • I think your output variable is also wrong. I've updated my answer. Apr 22 '19 at 18:16
  • I changed my output variable like your template and the first error "The value is not a Raster Layer" comes back. Apr 22 '19 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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