<?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 Link table values to ExtractByAttributes script in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/link-table-values-to-extractbyattributes-script/m-p/563078#M8139</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usuing ArcGIS Destop 10.7, I have 83 rasters that I need to loop through and perform an Extract By Attributes on using Python. Each raster has a range of values that the extracted pixels should be between. What I need to be able to do is insert the upper and lower bounding values from a table into the "where_clause".&lt;/P&gt;&lt;PRE class="" style="color: #4d4d4d; background-color: #fefefe; font-size: 0.75em; margin-bottom: 1.5em;"&gt;ExtractByAttributes(in_raster, where_clause)&lt;/PRE&gt;&lt;P&gt;I'm not exactly sure how to link the appropriate values to the corresponding raster. Each raster is named after a "Map_ID" and the same "Map_ID" is located in the table. The table only has 3 columns, the Map_ID, upper and lower bounding values. The current python script I have is as follows (red text is what needs to call the values from a table):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import system modules&lt;BR /&gt;import arcpy&lt;BR /&gt;from arcpy import env&lt;BR /&gt;from arcpy.sa import *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Set environment settings&lt;BR /&gt;arcpy.env.workspace = "C:\Users\Rast_conversion_Step_1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# set output folder&lt;BR /&gt;outWorkspace = "C:\Users\Rast_conversion_Step_2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# create list of rasters to perform raster math on&lt;BR /&gt;RasterList = arcpy.ListRasters() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for item in RasterList:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;inSQLClause = "Value &amp;gt;= (&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Map_ID lower value&lt;/STRONG&gt;&lt;/SPAN&gt;) and Value &amp;lt;= (&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Map_ID upper value&lt;/STRONG&gt;&lt;/SPAN&gt;)"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;extractRast = ExtractByAttributes(item, inSQLClause) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;outputRaster = os.path.join(outWorkspace, item)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExtractByAttributes.save(outputRaster)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jul 2020 22:34:04 GMT</pubDate>
    <dc:creator>JosephKennedy</dc:creator>
    <dc:date>2020-07-17T22:34:04Z</dc:date>
    <item>
      <title>Link table values to ExtractByAttributes script</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/link-table-values-to-extractbyattributes-script/m-p/563078#M8139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usuing ArcGIS Destop 10.7, I have 83 rasters that I need to loop through and perform an Extract By Attributes on using Python. Each raster has a range of values that the extracted pixels should be between. What I need to be able to do is insert the upper and lower bounding values from a table into the "where_clause".&lt;/P&gt;&lt;PRE class="" style="color: #4d4d4d; background-color: #fefefe; font-size: 0.75em; margin-bottom: 1.5em;"&gt;ExtractByAttributes(in_raster, where_clause)&lt;/PRE&gt;&lt;P&gt;I'm not exactly sure how to link the appropriate values to the corresponding raster. Each raster is named after a "Map_ID" and the same "Map_ID" is located in the table. The table only has 3 columns, the Map_ID, upper and lower bounding values. The current python script I have is as follows (red text is what needs to call the values from a table):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import system modules&lt;BR /&gt;import arcpy&lt;BR /&gt;from arcpy import env&lt;BR /&gt;from arcpy.sa import *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Set environment settings&lt;BR /&gt;arcpy.env.workspace = "C:\Users\Rast_conversion_Step_1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# set output folder&lt;BR /&gt;outWorkspace = "C:\Users\Rast_conversion_Step_2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# create list of rasters to perform raster math on&lt;BR /&gt;RasterList = arcpy.ListRasters() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for item in RasterList:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;inSQLClause = "Value &amp;gt;= (&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Map_ID lower value&lt;/STRONG&gt;&lt;/SPAN&gt;) and Value &amp;lt;= (&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;Map_ID upper value&lt;/STRONG&gt;&lt;/SPAN&gt;)"&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;extractRast = ExtractByAttributes(item, inSQLClause) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;outputRaster = os.path.join(outWorkspace, item)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExtractByAttributes.save(outputRaster)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2020 22:34:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/link-table-values-to-extractbyattributes-script/m-p/563078#M8139</guid>
      <dc:creator>JosephKennedy</dc:creator>
      <dc:date>2020-07-17T22:34:04Z</dc:date>
    </item>
  </channel>
</rss>

