<?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: Simple Python Question (Raster Clip) in ArcGIS Hub Questions</title>
    <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293505#M1502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So another quick n00b question here. As I understood using the Python in the ArcMap interface, the syntax is kind of laid out for you. This how I have been learning party, following the prompts after each coma. How come the prompts are giving me the option to put in my FC in the rectangle parameter and not asking for a string of coordinates? Without manually copying and pasting the extents could you not run this tool in the ArcMap python window?&amp;nbsp;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/484205_Auto.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2020 22:30:54 GMT</pubDate>
    <dc:creator>JonCicarelli</dc:creator>
    <dc:date>2020-03-05T22:30:54Z</dc:date>
    <item>
      <title>Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293499#M1496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am relatively new to scripting. I am going through Paul Zanderbergen’s Python book at the moment. I use Pro daily, but this book was written for ArcMap so I am using the ArcMap for these exercises.&lt;/P&gt;&lt;P&gt;Here is my question:&lt;/P&gt;&lt;P&gt;I am writing a script to extract land cover calcs from an input. I need to do &amp;nbsp;a raster clip to extract a raster file, but only using the rectangle extents and not a full on clip. Naturally I can get the tool in ArcMap &amp;nbsp;GUI to run just fine, but using&amp;nbsp; the arcpy.Clip_management module I cannot, for the life of me, get it to run.&lt;/P&gt;&lt;P&gt;Here is the code I am trying&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; color: black;"&gt;arcpy.Clip_management(“LULC","InputFile","LULCOutput.tif","InputFile","","ClippingGeometry","NO_MAINTAIN_EXTENT")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I basically need a raster rectangle output of my input feature class to use in later parts of my script.&lt;/P&gt;&lt;P&gt;Can anyone help me with my syntax to get this tool to run in python? I have the rest of my&amp;nbsp; script ready to go, I just cannot get this tool to run in python.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The image attached is how my file structure is set up (C:\LandCoverScript\GDB.gdb)&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 20:24:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293499#M1496</guid>
      <dc:creator>JonCicarelli</dc:creator>
      <dc:date>2020-03-05T20:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293500#M1497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/clip.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/clip.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Clip Raster—Data Management toolbox | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;look at the code example from there&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/Workspace"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Clip_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"image.tif"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"1952602.23 294196.279 1953546.23 296176.279"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"clip.gdb/clip"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; "&lt;SPAN class="comment token"&gt;#", "#", "NONE")&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The environment workspace (aka folder) containing the image is specified and the rectangular extent is specified by bounding coordinates in the same coordinate system as those of the tif.&lt;/P&gt;&lt;P&gt;What does your script look like?&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a workspace set up?&lt;/P&gt;&lt;P&gt;Is everything in the same projection?&lt;/P&gt;&lt;P&gt;do you have a bounding extent specified?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few thoughts&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:07:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293500#M1497</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T14:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293501#M1498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All is in the same coordinate system and I have set up my work space.&amp;nbsp; I am just trying to get the syntax right for arcpy.Clip_management()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working in the Python window in ArcMap and planing on later moving it into a IDLE.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question on the&amp;nbsp;rectangle extents however, I would need that to be the extents of my InputFile (basically a project area). Shouldn't those parameters be automatically populated if I specify "InputFile" for my rectangle? I shouldn't have to type out four extent coordiantes each time I run the script because those are going to change each time the parameter changes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your the help. I am a Python n00b and am trying to write a few scripts for practice.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 21:05:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293501#M1498</guid>
      <dc:creator>JonCicarelli</dc:creator>
      <dc:date>2020-03-05T21:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293502#M1499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the input is some other layer, you have to extract the "extent" from the featureclass (it is a geometry property) which can be derived from polygons and/or raster data. the "extent" can be converted to a string representation of the lower-left and upper-right coordinates.&amp;nbsp; For testing, grab your mouse and find those two coordinates, and make a string like in the example I posted, If you can progress from that, then the next step will be to move on to coding that&lt;/P&gt;&lt;P&gt;some homework&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/classes/extent.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/classes/extent.htm"&gt;Extent—ArcPy classes | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 21:22:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293502#M1499</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-05T21:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293503#M1500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I was able to manually get the extents as a string the clip worked. Is there another tool (or Python operation) I can use that can get to extract the extent so this tool can be automated?&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the tool in ArcMap I just specify that my extents will be that of the InputFile and the four coordinates populate automatically.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: Sorry I missed your link. I will dive into that and see what I can do!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="484173" alt="" class="jive-emoji image-1 jive-image" height="234" src="https://community.esri.com/legacyfs/online/484173_Extent.JPG" width="396" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 21:36:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293503#M1500</guid>
      <dc:creator>JonCicarelli</dc:creator>
      <dc:date>2020-03-05T21:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293504#M1501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;of course&lt;/P&gt;&lt;P&gt;using some of my data as an example and showing it stepwise.&amp;nbsp; in_fc7 would be a featureclass input parameter to your script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
desc &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_fc7&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- a polygon featureclass's "describe" object&lt;/SPAN&gt;
ext &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; desc&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'extent'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;              &lt;SPAN class="comment token"&gt;# ---- get the featureclass 'extent' property&lt;/SPAN&gt;
L&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; B&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; R&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; T &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ext&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;XMin&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ext&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YMin&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ext&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;XMax&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ext&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YMax   &lt;SPAN class="comment token"&gt;# ---- help file reading&lt;/SPAN&gt;
e_st &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;L&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; B&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; R&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; T&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- python format string stuff, more reading&lt;/SPAN&gt;

e_st

&lt;SPAN class="string token"&gt;'300000.0, 5000000.0, 300012.1075999997, 5000012.774999999'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ----- your extent&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:07:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293504#M1501</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T14:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293505#M1502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So another quick n00b question here. As I understood using the Python in the ArcMap interface, the syntax is kind of laid out for you. This how I have been learning party, following the prompts after each coma. How come the prompts are giving me the option to put in my FC in the rectangle parameter and not asking for a string of coordinates? Without manually copying and pasting the extents could you not run this tool in the ArcMap python window?&amp;nbsp;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/484205_Auto.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 22:30:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293505#M1502</guid>
      <dc:creator>JonCicarelli</dc:creator>
      <dc:date>2020-03-05T22:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Python Question (Raster Clip)</title>
      <link>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293506#M1503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you use the tool... that is what happens... which is what modelbuilder is for, combing arctoolbox tools into a nice workflow without having to worry about what goes on behind the scenes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When it comes time to code you own tools, there are several avenues you can take&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;have an "extent" parameter, which will allow you to define the clip extent from a featureclass&lt;/LI&gt;&lt;LI&gt;have a featureclass parameter used to define the extent.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Confused?&amp;nbsp; Good.&amp;nbsp; The first option means you are going directly to the "extent" property and if you have ever used a tool that wants you to specify one, you can actually specify the extent from a dataset or manually key in the numbers yourself.&amp;nbsp; If you create a "custom toolbox tool" you can specify these parameters through a dialog and associate them with a GetParameterAsText "thing".&amp;nbsp; But you are getting ahead of yourself.&amp;nbsp; The tool does the "magic" behind the scenes, I was just showing you have to get at that property that defines the extent rectangle.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2020 22:39:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-hub-questions/simple-python-question-raster-clip/m-p/293506#M1503</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-05T22:39:45Z</dc:date>
    </item>
  </channel>
</rss>

