<?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: Command for exporting rasters to points in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229239#M17775</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1/ are all the rasters in the same directory? &lt;/SPAN&gt;&lt;STRONG&gt;YES&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;2/ where do you want to store the output files?&lt;/SPAN&gt;&lt;STRONG&gt; In another directory.&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;3/ how do you want to name the output files? &lt;/SPAN&gt;&lt;STRONG&gt;Same as raster file.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; #import libraries&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #set environments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.env.workspace = r"C:\GIS\Projekti\Divaca_Ber_10ocen_met9\Testno\script"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... outworkspace = r"C:\GIS\Projekti\Divaca_Ber_10ocen_met9\Testno\script\point"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #create list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... rasterlist = arcpy.ListRasters("*")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #loop thru list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... for raster in rasterlist:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.RasterToPoint_conversion(rasterlist, outworkspace + "//" + str(raster) + "_point", "VALUE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #this confirms you are looking at the VALUE field of the raster, and calling the output file the same name as the raster, appended by _point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... del outworkspace, raster, rasterlist&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: Object: Error in executing tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the result. Is my path to folder correct (marked in red)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Feb 2014 10:20:42 GMT</pubDate>
    <dc:creator>SonjaVoncina</dc:creator>
    <dc:date>2014-02-04T10:20:42Z</dc:date>
    <item>
      <title>Command for exporting rasters to points</title>
      <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229237#M17773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone help me with Python code for exporting many rasters to points. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have numerous raster files I want to convert to points. I want program to open every raster in a folder and save its point file to another folder, name must stay the same. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have diffilculties defining inRaster and outRaster as I'm a newbie in Python language.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 07:19:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229237#M17773</guid>
      <dc:creator>SonjaVoncina</dc:creator>
      <dc:date>2014-02-04T07:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Command for exporting rasters to points</title>
      <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229238#M17774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The 'raster to point' tool will be able to help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A couple of questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1/ are all the rasters in the same directory?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2/ where do you want to store the output files?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3/ how do you want to name the output files?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be quite straightforward if all the rasters are in the same folder, and you want to store all of the point feature classes in the same location (ie in a folder if working with shapefiles, or in a geodatabase if working with feature clases)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The easiest thing to do would be to write a simple loop, using a list to contain all the names of the raster files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't have a arcpy-enabled machine with me tonight, so the code below isn't absolutely correct or validated, however you will want to do something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#import libraries

import arcpy
from arcpy import env

#set environments

arcpy.env.workspace = r'[file path to where your rasters are stored]
outworkspace = r'[file path to where you want to save outputs]

#create list

rasterlist = arcpy.ListRasters("*")

#loop thru list

for raster in rasterlist:
&amp;nbsp; arcpy.RasterToPoint_conversion(rasterlist, outworkspace + "//" + str(raster) + "_point", "VALUE")
&amp;nbsp; #this confirms you are looking at the VALUE field of the raster, and calling the output file the same name as the raster, appended by _point.

del outworkspace, raster, rasterlist

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:08:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229238#M17774</guid>
      <dc:creator>AnthonyCheesman1</dc:creator>
      <dc:date>2021-12-11T11:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Command for exporting rasters to points</title>
      <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229239#M17775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1/ are all the rasters in the same directory? &lt;/SPAN&gt;&lt;STRONG&gt;YES&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;2/ where do you want to store the output files?&lt;/SPAN&gt;&lt;STRONG&gt; In another directory.&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;3/ how do you want to name the output files? &lt;/SPAN&gt;&lt;STRONG&gt;Same as raster file.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; #import libraries&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #set environments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.env.workspace = r"C:\GIS\Projekti\Divaca_Ber_10ocen_met9\Testno\script"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... outworkspace = r"C:\GIS\Projekti\Divaca_Ber_10ocen_met9\Testno\script\point"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #create list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... rasterlist = arcpy.ListRasters("*")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #loop thru list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... for raster in rasterlist:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... arcpy.RasterToPoint_conversion(rasterlist, outworkspace + "//" + str(raster) + "_point", "VALUE")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... #this confirms you are looking at the VALUE field of the raster, and calling the output file the same name as the raster, appended by _point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... del outworkspace, raster, rasterlist&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;type 'exceptions.RuntimeError'&amp;gt;: Object: Error in executing tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the result. Is my path to folder correct (marked in red)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 10:20:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229239#M17775</guid>
      <dc:creator>SonjaVoncina</dc:creator>
      <dc:date>2014-02-04T10:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Command for exporting rasters to points</title>
      <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229240#M17776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is one minor mistake in the code that Anthony posted.&amp;nbsp; The code is trying to convert the entire rasterlist to a point feature class rather than the individual raster.&amp;nbsp; Try the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env&amp;nbsp; arcpy.env.workspace = r"C:\GIS\Projekti\Divaca_Ber_10ocen_met9\Testno\script" outworkspace = r"C:\GIS\Projekti\Divaca_Ber_10ocen_met9\Testno\script\point"&amp;nbsp; rasterlist = arcpy.ListRasters("*")&amp;nbsp; for raster in rasterlist: &amp;nbsp; arcpy.RasterToPoint_conversion(raster, outworkspace + "//" + str(raster) + ".shp", "VALUE")&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 11:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229240#M17776</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-02-04T11:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Command for exporting rasters to points</title>
      <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229241#M17777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;IT WORKS, IT WORKS!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 12:12:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229241#M17777</guid>
      <dc:creator>SonjaVoncina</dc:creator>
      <dc:date>2014-02-04T12:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Command for exporting rasters to points</title>
      <link>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229242#M17778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jake for picking up the error - I did notice that as I re-read the post over breakfast this morning.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Glad the process worked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 19:16:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-for-exporting-rasters-to-points/m-p/229242#M17778</guid>
      <dc:creator>AnthonyCheesman1</dc:creator>
      <dc:date>2014-02-04T19:16:49Z</dc:date>
    </item>
  </channel>
</rss>

