<?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: how to enter 'rectangle' argument in raster Clip in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245328#M3438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I know I need to use the extent -- I just can't get the arcpy.Clip_management command to accept the extent in the rectangle argument! &amp;nbsp;Of course I can enter it manually -- I need to do it within a script. &amp;nbsp;It is a formatting thing -- how to format the XMin YMin XMax YMax so as not to either crash ArcGIS completely, as occurs when I tried using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.extent = ...clip.tif&lt;/P&gt;&lt;P&gt;theExtent = arcpy.env.extent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;theExtent = clip.tif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if I try building the string of coordinates after using Describe to access the information, i.e.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theExtentRaster = clip.tif&lt;/P&gt;&lt;P style="border: 0px;"&gt;theDesc = arcpy.Describe(theExtentRaster)&lt;/P&gt;&lt;P style="border: 0px;"&gt;theExtent = theDesc.extent&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px;"&gt;theExtentString = str(theExtent.XMin) + ' ' + str(theExtent.YMin) + ' ' + str(theExtent.XMax) + ' ' + str(theExtent.YMax)&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;I get this error: &amp;nbsp;ExecuteError: ERROR 000622: Failed to execute (Clip). Parameters are not valid. ERROR 000628: Cannot set input into parameter rectangle.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;I also tried adding single quotes or double quotes to theExtentString.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;So, again, it isn't accessing the information, (I even tried the code snippet in the Extent page you referenced), it is FORMATTING the four coordinates in a way the arcpy.Clip_management command will accept.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;Any ideas? &amp;nbsp;Thanks, Darlene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Sep 2016 14:39:08 GMT</pubDate>
    <dc:creator>DarleneWilcox</dc:creator>
    <dc:date>2016-09-08T14:39:08Z</dc:date>
    <item>
      <title>how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245326#M3436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;I have a raster that I want to clip to a county boundary (no data outside county). &amp;nbsp;It is a stretched NDVI tif, so the values of the raster are 0-255. &amp;nbsp;I tried using the Con function, but it produced an output raster with values from 6 to 66500-ish. &amp;nbsp;I determined that what would work is the raster Clip tool and checking the 'Use Input Features for Clipping Geometry' box. &amp;nbsp;The results are fine -- no data outside the county, correct values inside the county -- EXCEPT that the extent of the output raster is the extent of the county polygon, and I want it to be a different, larger extent (so as to be the same size as other raster datasets).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Python Snippet comes out like this:&lt;/P&gt;&lt;P&gt;# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the&lt;/P&gt;&lt;P&gt;# layer/table view within the script.&lt;BR /&gt;# The following inputs are layers or table views: "...a.tif", "...b.shp"&lt;BR /&gt;arcpy.Clip_management(in_raster="...a.tif", rectangle="677439.999999999 3721040 678360.000000007 3722960", out_raster="...c.tif", in_template_dataset="b.shp", nodata_value="256", clipping_geometry="ClippingGeometry", maintain_clipping_extent="NO_MAINTAIN_EXTENT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can replace all the dataset arguments with variables:&lt;/P&gt;&lt;P&gt;theInRaster &amp;nbsp; = ...a.tif&lt;/P&gt;&lt;P&gt;theCntyShp &amp;nbsp; = ...b.shp&lt;/P&gt;&lt;P&gt;theOutRaster = ...c.tif&lt;/P&gt;&lt;P&gt;arcpy.Clip_management(in_raster= theInRaster",&lt;/P&gt;&lt;P&gt;&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; rectangle="677439.999999999 3721040 678360.000000007 3722960",&lt;/P&gt;&lt;P&gt;&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; out_raster=theOutRaster,&lt;/P&gt;&lt;P&gt;&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; in_template_dataset=theCntyShp,&lt;/P&gt;&lt;P&gt;&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; nodata_value="256", clipping_geometry="ClippingGeometry",&lt;/P&gt;&lt;P&gt;&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; maintain_clipping_extent="NO_MAINTAIN_EXTENT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I want the rectangle argument to be equal to the extent of clip.tif. &amp;nbsp;I tried setting the arcpy.env.extent to clip.tif and leaving the rectangle argument blank (""), but it went to the smaller extent of the polygon. &amp;nbsp;So, I need to actually put 'something' in the rectangle coordinates. &amp;nbsp;I tried setting theExtent to several things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theExtent = arcpy.env.extent &amp;nbsp;and then rectangle = theExtent &amp;nbsp; &amp;nbsp;#crashed ArcGIS completely&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theExtentRaster = ...clip.tif and then rectangle = theExtentRaster &amp;nbsp;#crashed ArcGIS completely&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theDesc = arcpy.Describe(theExtentRaster)&lt;/P&gt;&lt;P&gt;theExtent = theDesc.extent and then rectangle = theExtent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theDesc = arcpy.Describe(theExtentRaster)&lt;/P&gt;&lt;P&gt;theExtent = theDesc.extent and then rectangle = theExtent&lt;/P&gt;&lt;P&gt;theExtentString = str(theExtent.XMin) + ' ' + str(theExtent.YMin) + ' ' + str(theExtent.XMax) + ' ' + str(theExtent.YMax) and then rectangle = theExtentString&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also trying adding either single quotes or double quotes to theExtentString&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all result in this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000622: Failed to execute (Clip). Parameters are not valid. ERROR 000628: Cannot set input into parameter rectangle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, clearly, there is SOME OTHER WAY to define the rectangle. &amp;nbsp;I'm hoping someone out there can help.... &amp;nbsp;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2016 22:30:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245326#M3436</guid>
      <dc:creator>DarleneWilcox</dc:creator>
      <dc:date>2016-09-07T22:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245327#M3437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the extent object of the desired raster directly as shown in the example script here&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/raster-object.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/raster-object.htm"&gt;Raster—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;you can also examine the extent object if your wish as well,&amp;nbsp;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/extent.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-classes/extent.htm"&gt;Extent—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2016 22:41:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245327#M3437</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-09-07T22:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245328#M3438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, I know I need to use the extent -- I just can't get the arcpy.Clip_management command to accept the extent in the rectangle argument! &amp;nbsp;Of course I can enter it manually -- I need to do it within a script. &amp;nbsp;It is a formatting thing -- how to format the XMin YMin XMax YMax so as not to either crash ArcGIS completely, as occurs when I tried using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.extent = ...clip.tif&lt;/P&gt;&lt;P&gt;theExtent = arcpy.env.extent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&amp;nbsp;&lt;/P&gt;&lt;P&gt;theExtent = clip.tif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if I try building the string of coordinates after using Describe to access the information, i.e.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theExtentRaster = clip.tif&lt;/P&gt;&lt;P style="border: 0px;"&gt;theDesc = arcpy.Describe(theExtentRaster)&lt;/P&gt;&lt;P style="border: 0px;"&gt;theExtent = theDesc.extent&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px;"&gt;theExtentString = str(theExtent.XMin) + ' ' + str(theExtent.YMin) + ' ' + str(theExtent.XMax) + ' ' + str(theExtent.YMax)&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;I get this error: &amp;nbsp;ExecuteError: ERROR 000622: Failed to execute (Clip). Parameters are not valid. ERROR 000628: Cannot set input into parameter rectangle.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;I also tried adding single quotes or double quotes to theExtentString.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;So, again, it isn't accessing the information, (I even tried the code snippet in the Extent page you referenced), it is FORMATTING the four coordinates in a way the arcpy.Clip_management command will accept.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;Any ideas? &amp;nbsp;Thanks, Darlene&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 14:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245328#M3438</guid>
      <dc:creator>DarleneWilcox</dc:creator>
      <dc:date>2016-09-08T14:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245329#M3439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this :&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;ExtStr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{} {} {} {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;XMin&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YMin&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; XMax&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YMax&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 14:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245329#M3439</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2016-09-08T14:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245330#M3440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neil Ayres ... you rock! &amp;nbsp;That worked -- yeah!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know where (other than right here!) this is documented? -- no joke when I say I spent all day yesterday trying every thing I could think of and searching all over the forums and stack exchange and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again -- THANK YOU!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 15:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245330#M3440</guid>
      <dc:creator>DarleneWilcox</dc:creator>
      <dc:date>2016-09-08T15:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245331#M3441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's just that adding strings to other strings with other strings and all the extra quotes etc, sometimes get very confusing.&lt;/P&gt;&lt;P&gt;the "{Var1} {Var2} {Var3}".format(x, y, z) syntax is much clearer.&lt;/P&gt;&lt;P&gt;Glad it worked for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 18:55:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245331#M3441</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2016-09-08T18:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to enter 'rectangle' argument in raster Clip</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245332#M3442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darlene&lt;/P&gt;&lt;P&gt;I have written a couple of blogs on formating in python and numpy... here is one of several&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/03/01/basic-fancy-formats"&gt;/blogs/dan_patterson/2016/03/01/basic-fancy-formats&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 19:50:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/how-to-enter-rectangle-argument-in-raster-clip/m-p/245332#M3442</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-09-08T19:50:22Z</dc:date>
    </item>
  </channel>
</rss>

