<?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 Re: Rectangle for Clip_management tool in arcpy in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380882#M13002</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks but I still get the "The value is not a Envelope." error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Documents and Settings\Administrator\Desktop\clip_test.py", line 15, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management (raster, dsc.extent, outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 7692, in Clip&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000840: The value is not a Envelope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Clip).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Aug 2010 17:20:54 GMT</pubDate>
    <dc:creator>RichNauman</dc:creator>
    <dc:date>2010-08-02T17:20:54Z</dc:date>
    <item>
      <title>Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380880#M13000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been struggling to get this part of a script to work. If I hard code the four coordinate pairs: like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rectangle = "-121.677618762735 42.7497214280392 -119.35205017646 45.3659860875993"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it works but we have to remember to change this every time we change study areas. When I run the script pasted below I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Documents and Settings\Administrator\Desktop\clip_test.py", line 13, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management (raster, rectangle, outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 7692, in Clip&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000840: The value is not a Envelope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Clip).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"C:\Temp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;raster = "some_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outraster = r"C:\output_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extent = r"C:\GIS_Data\test_extent2.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;desc = arcpy.Describe(extent)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rectangle = desc.extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print rectangle&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Clip_management (in_raster, rectangle, out_raster, {in_template_dataset}, {nodata_value}, {clipping_geometry})&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Clip_management (raster, rectangle, outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Success!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 15:57:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380880#M13000</guid>
      <dc:creator>RichNauman</dc:creator>
      <dc:date>2010-08-02T15:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380881#M13001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"C:\Temp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster = "some_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outraster = r"C:\output_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extentFC = r"C:\GIS_Data\test_extent2.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dsc = arcpy.describe(extent)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Clip_management (raster, dsc.extent, outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;###or if you want to mask it using extentFC as the outline:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;##arcpy.Clip_management (raster, dsc.extent, outraster, extentFC, "", "CLIPPINGGEOMETRY")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 17:00:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380881#M13001</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2010-08-02T17:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380882#M13002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks but I still get the "The value is not a Envelope." error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Documents and Settings\Administrator\Desktop\clip_test.py", line 15, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_management (raster, dsc.extent, outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 7692, in Clip&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000840: The value is not a Envelope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Clip).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 17:20:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380882#M13002</guid>
      <dc:creator>RichNauman</dc:creator>
      <dc:date>2010-08-02T17:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380883#M13003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm... Maybe a bug in v10?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an excerpt of some v9.3 code that works for me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Process: Creates a blank GDB&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fgdbName = "oesf_score_gnn_raster"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fgdbPath = root + "\\" + fgdbName + ".gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CreateFileGDB_management(root, fgdbName); showGpMessage()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Process: Extract the OESF&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hcpUnitFC = r"\\Snarf\am\div_lm\ds\gis\tools\sde_connections_read\ropa_gis_layer_user.sde\ROPA.HCPUNIT"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oesfFC = fgdbPath + "\\oesf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Select_analysis(hcpUnitFC, oesfFC, "HCPUNIT_NM = 'OESF'"); showGpMessage()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Process: Buffer the oesf&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oesfBufferUnits = "FEET"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oesfBufferDistance = "35000" #NOTE: This MUST be the same buffer distance as in 'nso_make_path_distance_grids_v93.py'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oesfBufferFC = fgdbPath + "\\oesf_buff_" + str(oesfBufferDistance) + oesfBufferUnits.lower()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Buffer_analysis(oesfFC, oesfBufferFC, str(oesfBufferDistance) + " " + oesfBufferUnits.upper(), "FULL", "ROUND", "NONE", ""); showGpMessage()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Process: Clip the GNN data to our area of interest&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gnnReadGrd = r"\\snarf\am\div_lm\ds\gis\tools\sde_connections_read\raster_gis_layer_user.sde\SHARED_LM.GNN_20100303"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.extent = oesfBufferFC&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.extent = snapExtentToRaster(gp.extent, gnnReadGrd)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.mask = oesfBufferFC&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.cellsize = gnnReadGrd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gnnClipGrd = fgdbPath + "\\gnn_clip"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Clip_management(gnnReadGrd, gp.extent, gnnClipGrd, oesfBufferFC, "", "CLIPPINGGEOMETRY")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 17:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380883#M13003</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2010-08-02T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380884#M13004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Richard,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You won't be able to use a Extent object directly as input to Clip, but since you can use geometry objects, Polygon, etc.&amp;nbsp; So, really it just a matter of converting that extent into a polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Working from your original code, something like below should do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = r"C:\Temp"

raster = "some_raster"
outraster = r"C:\output_raster"
desc = arcpy.Describe(r"C:\GIS_Data\test_extent2.shp")
extent = desc.extent

rectangle = arcpy.Polygon(arcpy.Array([extent.lowerLeft, extent.upperLeft, extent.upperRight, extent.lowerRight, extent.lowerLeft]),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc.spatialReference)

print rectangle

# Clip_management (in_raster, rectangle, out_raster, {in_template_dataset}, {nodata_value}, {clipping_geometry})
arcpy.Clip_management(raster, rectangle, outraster)

print "Success!"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:34:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380884#M13004</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2021-12-11T17:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380885#M13005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like I will be rewriting a lot of v9.3 code to make it arcpy compatible...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 17:05:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380885#M13005</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2010-08-03T17:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380886#M13006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Looks like I will be rewriting a lot of v9.3 code to make it arcpy compatible...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, I was overthinking that example &lt;/SPAN&gt;&lt;STRONG&gt;way&lt;/STRONG&gt;&lt;SPAN&gt; too much.&amp;nbsp; It could also be done by converting the extent to a string like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;desc = arcpy.Describe(r"C:\GIS_Data\test_extent2.shp")
extent = desc.extent

# Clip_management (in_raster, rectangle, out_raster, {in_template_dataset}, {nodata_value}, {clipping_geometry})
arcpy.Clip_management(raster, &lt;SPAN style="font-style:italic;"&gt;str(extent)&lt;/SPAN&gt;, outraster)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully, that is more agreeable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:34:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380886#M13006</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2021-12-11T17:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380887#M13007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I like that better!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 17:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380887#M13007</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2010-08-03T17:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380888#M13008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the help but I am still struggling.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster = r"Y:\GIS_Data\raster1"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outraster = r"Y:\GIS_Data\delete_me"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;desc = arcpy.Describe(r"Y:\GIS_Data\test_extent2.shp")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;frame = str(desc.extent)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;frame = str(frame [:-16])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;frame = str('"' + frame + '"')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print frame&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Clip_management (raster, "-121.677618762735 42.7497214280392 -119.35205017646 45.3659860875993", outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Done!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But this one does not:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;raster = r"Y:\GIS_Data\raster1"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outraster = r"Y:\GIS_Data\delete_me"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;desc = arcpy.Describe(r"Y:\GIS_Data\test_extent2.shp")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;frame = str(desc.extent)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;frame = str(frame [:-16])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;frame = str('"' + frame + '"')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print frame&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Clip_management (raster,frame, outraster)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Done!"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copied and posted the output from the "print frame" statement into the clip statement to get it to work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 20:19:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380888#M13008</guid>
      <dc:creator>RichNauman</dc:creator>
      <dc:date>2010-08-03T20:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380889#M13009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;desc = arcpy.Describe(r"Y:\GIS_Data\test_extent2.shp")
frame = str(desc.extent)
frame = str(frame [:-16])
frame = str('"' + frame + '"')&lt;/PRE&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't bother with the extra quotes in this last line, I'm pretty sure this is the cause of your error.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead, just do this (leaving out your last &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;frame =&lt;/SPAN&gt;&lt;SPAN&gt; line)...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;frame = str(desc.extent)
frame = frame[:-16]&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;or, if your intention is to strip out all the NaN's at the end, you could also do this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;frame = str(desc.extent).strip(" NaN")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:34:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380889#M13009</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2021-12-11T17:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380890#M13010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the help!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure where I went off track but the following works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
raster = r"c:\GIS_Data\some_raster"
outraster = r"c:\GIS_Data\delete_me"

desc = arcpy.Describe(r"c:\GIS_Data\test_extent2.shp")
frame = str(desc.extent)

arcpy.Clip_management (raster, frame, outraster)
print "Done!"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:34:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380890#M13010</guid>
      <dc:creator>RichNauman</dc:creator>
      <dc:date>2021-12-11T17:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rectangle for Clip_management tool in arcpy</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380891#M13011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried applying this code to several rasters from different resolution source imagery? Do you get the same extents in the long run?&amp;nbsp; I am having major trouble clipping my rasters to specific extents and having them come out the EXACT same. I keep getting some of them the same as I am trying to use and some with extra decimals (ex. Raster Extent Interested: 524002.75 5167611.25 542557.75 5188001.25; Raster Extent Result: 524002.74999979 5167611.25012111 542557.74999979 5188001.25012111).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thoughts?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Mar 2011 21:48:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/rectangle-for-clip-management-tool-in-arcpy/m-p/380891#M13011</guid>
      <dc:creator>JenniferCorcoran</dc:creator>
      <dc:date>2011-03-19T21:48:29Z</dc:date>
    </item>
  </channel>
</rss>

