<?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 Reiterating through features in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reiterating-through-features/m-p/1141257#M63672</link>
    <description>&lt;P&gt;I'm trying to reiterate though polygons of a shape file to extract seperate rasters through the function extractionbymask.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code right now but it ends in the error code ER000732: Input Raster &amp;nbsp;does not exist or is not supported. &amp;nbsp;I ran this in the python window and can see that both inputs show up, but the output is empty.&lt;/P&gt;&lt;P&gt;I'm a beginner so I have probably missed something obvious but have been unable to figure out what.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# First import arcpython and set environment&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os&lt;BR /&gt;arcpy.env.workspace= "E:\\GIS_Work\\Python"&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;from arcpy.sa import *&lt;BR /&gt;from arcpy import env&lt;BR /&gt;print("Environment set")&lt;/P&gt;&lt;P&gt;#Define variables&lt;/P&gt;&lt;P&gt;S_M_Map= Raster("SLUMFKKlassad.tif")&lt;BR /&gt;Zone = "Split.shp"&lt;/P&gt;&lt;P&gt;print ("Variables defined")&lt;/P&gt;&lt;P&gt;Check out license&lt;BR /&gt;arcpy.CheckOutExtension("Spatial")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#Create Iteration #Extract Raster to Polygon&lt;BR /&gt;i = 1&lt;BR /&gt;with arcpy.da.SearchCursor(Zone, 'Shape@') as cursor:&lt;BR /&gt;for row in cursor:&lt;BR /&gt;name = "Location"+str(i)&lt;BR /&gt;i = i+1&lt;BR /&gt;print (name)&lt;BR /&gt;outExtractByMask = ExtractByMask(S_M_Map, row)&lt;BR /&gt;outExtractByMask.save(name)&lt;/P&gt;</description>
    <pubDate>Mon, 07 Feb 2022 17:00:04 GMT</pubDate>
    <dc:creator>Anna_Anna</dc:creator>
    <dc:date>2022-02-07T17:00:04Z</dc:date>
    <item>
      <title>Reiterating through features</title>
      <link>https://community.esri.com/t5/python-questions/reiterating-through-features/m-p/1141257#M63672</link>
      <description>&lt;P&gt;I'm trying to reiterate though polygons of a shape file to extract seperate rasters through the function extractionbymask.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code right now but it ends in the error code ER000732: Input Raster &amp;nbsp;does not exist or is not supported. &amp;nbsp;I ran this in the python window and can see that both inputs show up, but the output is empty.&lt;/P&gt;&lt;P&gt;I'm a beginner so I have probably missed something obvious but have been unable to figure out what.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# First import arcpython and set environment&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os&lt;BR /&gt;arcpy.env.workspace= "E:\\GIS_Work\\Python"&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;from arcpy.sa import *&lt;BR /&gt;from arcpy import env&lt;BR /&gt;print("Environment set")&lt;/P&gt;&lt;P&gt;#Define variables&lt;/P&gt;&lt;P&gt;S_M_Map= Raster("SLUMFKKlassad.tif")&lt;BR /&gt;Zone = "Split.shp"&lt;/P&gt;&lt;P&gt;print ("Variables defined")&lt;/P&gt;&lt;P&gt;Check out license&lt;BR /&gt;arcpy.CheckOutExtension("Spatial")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#Create Iteration #Extract Raster to Polygon&lt;BR /&gt;i = 1&lt;BR /&gt;with arcpy.da.SearchCursor(Zone, 'Shape@') as cursor:&lt;BR /&gt;for row in cursor:&lt;BR /&gt;name = "Location"+str(i)&lt;BR /&gt;i = i+1&lt;BR /&gt;print (name)&lt;BR /&gt;outExtractByMask = ExtractByMask(S_M_Map, row)&lt;BR /&gt;outExtractByMask.save(name)&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 17:00:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reiterating-through-features/m-p/1141257#M63672</guid>
      <dc:creator>Anna_Anna</dc:creator>
      <dc:date>2022-02-07T17:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reiterating through features</title>
      <link>https://community.esri.com/t5/python-questions/reiterating-through-features/m-p/1141272#M63673</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;to provide line numbers and proper indentation&lt;/P&gt;&lt;P&gt;The output files should be rasters but I suggest *.tif files&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;name = "Location"+str(i) +".tif"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and you can use row for the extraction you have to use the file... name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but you need a layer or raster not the shape so you will either have to make a feature layer or do a select by attribute to select on the object id field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm" target="_blank"&gt;Make Feature Layer (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;not sure what you want to do in that regard&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ExtractByMask(S_M_Map, zone)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/extract-by-mask.htm" target="_blank"&gt;Extract by Mask (Spatial Analyst)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 17:23:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reiterating-through-features/m-p/1141272#M63673</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-07T17:23:29Z</dc:date>
    </item>
  </channel>
</rss>

