<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ExtractByRectangle Error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/extractbyrectangle-error/m-p/271478#M20987</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to subset the NLCD dataset (.img format) using the geoprocessing ExtractByRectangle function and getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Exception:ERROR 999998: Unexpected Error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (ExtractByRectangle).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OriginalNLCDDataSetFile = r"E:\Scratch\USALandCoveData\nlcd2006_landcover_se5.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExtractedNLCDFileName = "r"E:\Scratch\USALandCoveData\ExtractedWSNLCD.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BufferedWSFile = r"E:\temp\shapefiles\save\bufferedWatershed.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CheckOutExtension("spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CheckOutExtension("spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Process: Extract by Rectangle&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Ref: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z0000002r000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z0000002r000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;#get the rectangular boundary of the WS shape file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeFileDesc = arcpy.Describe(BufferedWSFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;wsBoundingBoxExtent = Extent(shapeFileDesc.extent.XMin, shapeFileDesc.extent.YMin, shapeFileDesc.extent.XMax, shapeFileDesc.extent.YMax)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Arial Black;"&gt;gp.ExtractByRectangle_sa(OriginalNLCDDataSetFile, wsBoundingBoxExtent, ExtractedNLCDFile, "INSIDE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the mentioned error when executing the highlighted statement above. I have done similar extraction coding and they all run fine. The only difference I know in this case is the file format and size. The original nlcd file is of .img format in this code example. The similar code to extract that has worked for me have file formats of .tif. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would appreciate help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PK&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jan 2013 22:06:05 GMT</pubDate>
    <dc:creator>PabitraDash</dc:creator>
    <dc:date>2013-01-16T22:06:05Z</dc:date>
    <item>
      <title>ExtractByRectangle Error</title>
      <link>https://community.esri.com/t5/python-questions/extractbyrectangle-error/m-p/271478#M20987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to subset the NLCD dataset (.img format) using the geoprocessing ExtractByRectangle function and getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Exception:ERROR 999998: Unexpected Error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (ExtractByRectangle).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OriginalNLCDDataSetFile = r"E:\Scratch\USALandCoveData\nlcd2006_landcover_se5.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExtractedNLCDFileName = "r"E:\Scratch\USALandCoveData\ExtractedWSNLCD.img"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BufferedWSFile = r"E:\temp\shapefiles\save\bufferedWatershed.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CheckOutExtension("spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CheckOutExtension("spatial")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Process: Extract by Rectangle&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Ref: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z0000002r000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z0000002r000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;#get the rectangular boundary of the WS shape file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeFileDesc = arcpy.Describe(BufferedWSFile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;wsBoundingBoxExtent = Extent(shapeFileDesc.extent.XMin, shapeFileDesc.extent.YMin, shapeFileDesc.extent.XMax, shapeFileDesc.extent.YMax)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Arial Black;"&gt;gp.ExtractByRectangle_sa(OriginalNLCDDataSetFile, wsBoundingBoxExtent, ExtractedNLCDFile, "INSIDE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get the mentioned error when executing the highlighted statement above. I have done similar extraction coding and they all run fine. The only difference I know in this case is the file format and size. The original nlcd file is of .img format in this code example. The similar code to extract that has worked for me have file formats of .tif. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would appreciate help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PK&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 22:06:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbyrectangle-error/m-p/271478#M20987</guid>
      <dc:creator>PabitraDash</dc:creator>
      <dc:date>2013-01-16T22:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: ExtractByRectangle Error</title>
      <link>https://community.esri.com/t5/python-questions/extractbyrectangle-error/m-p/271479#M20988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;PK,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You create a variable called "ExtractedNLCDFileName" for your output raster, then as an argument for your out_raster you use "ExtractedNLCDFile". &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2013 20:06:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extractbyrectangle-error/m-p/271479#M20988</guid>
      <dc:creator>JimCousins</dc:creator>
      <dc:date>2013-01-17T20:06:28Z</dc:date>
    </item>
  </channel>
</rss>

