Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Failed to execute (ExtractByMask)

$
0
0

I use ExtractByMask of arcpy to isolate to subset the provinces of the Philippines. I do it with this code.

import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.CheckOutExtension("Spatial")
env.overwriteOutput = True

#Set the current workspace
env.workspace = (r"C:thesisLATESTLATEST Forest MasksESSC")
env.nodata = "MINIMUM"
env.compression = "LZ77"


list_10_110 = ['Sulu.shp','Palawan.shp','Tawi-Tawi.shp']
#This is for extracting the forest areas of hansen percent treecover
#loop the list
    for i in list_10_110:
    print "Extracting " + i + " in 10_110"
    env.workspace = (r"C:thesisLATESTLATEST Forest MasksESSC")
    for raster in arcpy.ListRasters("*10N_110E.tif", "TIF"):
    env.workspace = (r"C:thesisLATESTLATEST Forest MasksESSC")
    print raster #checking the presence of raster
    outputRasterExtractbyMask = ExtractByMask(raster, i)
    #prov=i.replace(".shp", "_")
    #outputRasterExtractbyMask_Name = prov + raster
    #env.workspace = (r"C:thesisLATESTLATEST Forest MasksESSCPer Province")
    #outputRasterExtractbyMask.save(outputRasterExtractbyMask_Name)

However, I’m getting this error message:

Traceback (most recent call last):
File "C:UsersbrentiebarkDropboxPython Scripts and mxdsextract by mask_NAMRIA.py"
outputRasterExtractbyMask = ExtractByMask(raster, i)
File "C:Program Files (x86)ArcGISDesktop10.1arcpyarcpysaFunctions.py", line 
6631, in ExtractByMask in_mask_data)
File "C:Program Files (x86)ArcGISDesktop10.1arcpyarcpysaUtils.py", line 47, 
in swapper result = wrapper(*args, **kwargs)
File "C:Program Files (x86)ArcGISDesktop10.1arcpyarcpysaFunctions.py",
line 6627, in wrapper out_raster)
File "C:Program Files (x86)ArcGISDesktop10.1arcpyarcpygeoprocessing_base.py", 
line 484, in <lambda>
return lambda *args: val(*gp_fixargs(args, True)) 
ExecuteError: ERROR 010024: Error during conversion.
Failed to execute (ExtractByMask).

I’ve checked my input raster and input mask (.shps), and didn’t seem to find any mistake.


Viewing all articles
Browse latest Browse all 767

Trending Articles