[GIS] Error with the Contour (Spatial Analyst) tool in ArcGIS

arcgis-desktopcontourspatial-analyst

I am having an issue with the Contour (Spatial Analyst) tool in ArcGIS. When I manually run the tool in ArcToolbox, it will sometimes say that the tool has failed, giving the following error message:

ExecuteError: ERROR 010157: Unable to open feature class F:\2014\data\083c15_contour.shp
Failed to execute (Contour).

The strange part is that when I go to the output location of the tool the shapefile is there, and I can open it in ArcMap without an issue.

When I use Python to run the tool, I receive the same error message, and I can't figure out why. This is the loop I have that is meant to convert a list of DEM files into contour shapefiles:

    for dem_file in dem_files:
        file_split = dem_file.split("_")
        file_name = job_folder + "\\" + file_split[0] + "_contour.shp"
        arcpy.sa.Contour(dem_file, file_name, contour_interval)

When I run the script, I can go to the output location and bring the shapefile into ArcMap, even though there was an error. So I don't think this is an issue with my code because it also happens when I run the tool manually. Does anyone know how I can work around this error?

Best Answer

Try putting the output shapefile in a different folder - such as C:\temp\test_083c15_contour.shp. I think you might be having problems because 1 of your folders is named with a leading number or your output shapefile is named with a leading number.

Related Question