<?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: Export values of rasters without attribute table in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005337#M24917</link>
    <description>&lt;P&gt;Thank you, I tried to install xlsxwrite with several ways but "invalid syntax" message is always appeared..&lt;/P&gt;</description>
    <pubDate>Sat, 28 Nov 2020 21:05:47 GMT</pubDate>
    <dc:creator>CamiSunley</dc:creator>
    <dc:date>2020-11-28T21:05:47Z</dc:date>
    <item>
      <title>Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005284#M24909</link>
      <description>&lt;P&gt;Hello, everyone !&lt;/P&gt;&lt;P&gt;I have a file with multiple rasters (stretched - without attribute table - but with only one value e.g. min value = max value) and I am trying to export each raster's value in a table/xls file where the values from all the rasters will have been registered (in a column for example) using model builder or arcpy.&lt;/P&gt;&lt;P&gt;Any suggestion is welcomed, thank you !&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 12:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005284#M24909</guid>
      <dc:creator>CamiSunley</dc:creator>
      <dc:date>2020-11-28T12:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005285#M24910</link>
      <description>&lt;P&gt;How many rasters have you got? You're saying each raster is made of cells entirely of one value?&lt;/P&gt;&lt;P&gt;Can you post a picture of this?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;raster_object = arcpy.Raster(r'C:\MyStuff\Geo\Raster1.tif)
min_value = raster_object.minimum
max_value = raster_object.maximum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 13:01:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005285#M24910</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-11-28T13:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005289#M24911</link>
      <description>&lt;P&gt;I have 1176 rasters. Yes,&amp;nbsp;&lt;SPAN&gt;each raster is made of cells entirely of one value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="raster.JPG" style="width: 203px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/1129i70A4E65A197EB3DA/image-size/large?v=v2&amp;amp;px=999" role="button" title="raster.JPG" alt="raster.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 13:11:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005289#M24911</guid>
      <dc:creator>CamiSunley</dc:creator>
      <dc:date>2020-11-28T13:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005290#M24912</link>
      <description>&lt;P&gt;try the above script on one of the rasters.&amp;nbsp; If that works, it can easily be put into a for loop to iterate over the 1000.&amp;nbsp; Unsure if it's the fastest way if you're looking to do this regularly? Maybe&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;has a numpy method.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 13:16:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005290#M24912</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-11-28T13:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005291#M24913</link>
      <description>&lt;P&gt;Thank you, I' ll try it.. Should I add an 'export' expression after your script so as to save the value in a new table/array ?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 13:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005291#M24913</guid>
      <dc:creator>CamiSunley</dc:creator>
      <dc:date>2020-11-28T13:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005292#M24914</link>
      <description>&lt;P&gt;for the moment just use&lt;/P&gt;&lt;P&gt;print(min_value)&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 13:30:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005292#M24914</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-11-28T13:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005314#M24915</link>
      <description>&lt;P&gt;You can read min values from the each raster and add to a list, then write into an excel file. You might need to download xlswriter library or write into .dbf file and convert to excel file. There are multiple ways writing from list to excel file&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;os&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;xlsxwriter&lt;BR /&gt;&lt;BR /&gt;raster_list = os.listdir(path/to/rasterfolder)&lt;BR /&gt;value_list = []&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;each_raster &lt;SPAN&gt;in &lt;/SPAN&gt;raster_list:&lt;BR /&gt;    result = arcpy.GetRasterProperties_management(&lt;SPAN&gt;each_raster&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"MINIMUM"&lt;/SPAN&gt;)&lt;BR /&gt;    min_value = result.getOutput(&lt;SPAN&gt;0&lt;/SPAN&gt;)&lt;BR /&gt;    value_list.add(min_value)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with &lt;/SPAN&gt;xlsxwriter.Workbook(&lt;SPAN&gt;'RasterValues.xlsx'&lt;/SPAN&gt;) &lt;SPAN&gt;as &lt;/SPAN&gt;workbook:&lt;BR /&gt;    worksheet = workbook.add_worksheet()&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;row_num&lt;SPAN&gt;, &lt;/SPAN&gt;data &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;enumerate&lt;/SPAN&gt;(value_list):&lt;BR /&gt;        worksheet.write_row(row_num&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;data)&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 16:34:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005314#M24915</guid>
      <dc:creator>Amadeus111</dc:creator>
      <dc:date>2020-11-28T16:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005317#M24916</link>
      <description>&lt;LI-CODE lang="python"&gt;import arcpy
import numpy as np

arcpy.env.workspace = "c:/data/DEMS"  # --- Set the current workspace
rasters = arcpy.ListRasters("*")
out = []
for raster in rasters:
    inRas = arcpy.Raster(raster)
    arr = arcpy.RasterToNumPyArray(inRas)
    ras_min = np.min(arr)
    out.append([raster, ras_min])
print(out)

# ---- for now, just print it or see
# NumPyArrayToTable&lt;/LI-CODE&gt;&lt;P&gt;Now, if you have nodata values to account for, then the code will have to be edited, or if the rasters are all over the place, then good luck.&lt;/P&gt;&lt;P&gt;This should give you an idea... but I never tested it, just cobbled together from the help files&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/numpyarraytotable.htm" target="_blank"&gt;NumPyArrayToTable—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 16:41:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005317#M24916</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-11-28T16:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005337#M24917</link>
      <description>&lt;P&gt;Thank you, I tried to install xlsxwrite with several ways but "invalid syntax" message is always appeared..&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 21:05:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005337#M24917</guid>
      <dc:creator>CamiSunley</dc:creator>
      <dc:date>2020-11-28T21:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Export values of rasters without attribute table</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005338#M24918</link>
      <description>&lt;P&gt;Thank you, I replaced 'min' with 'max' and it returned the right values, because when I run it for 'min' it returned numbers tending to zero.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Nov 2020 21:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/export-values-of-rasters-without-attribute-table/m-p/1005338#M24918</guid>
      <dc:creator>CamiSunley</dc:creator>
      <dc:date>2020-11-28T21:14:19Z</dc:date>
    </item>
  </channel>
</rss>

