<?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: Unable to open feature class Failed to execute (RasterToPolygon) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213944#M16494</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh, sorry for my formatting, yes my for loop is indented.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Aug 2014 11:08:58 GMT</pubDate>
    <dc:creator>RobertBeno</dc:creator>
    <dc:date>2014-08-11T11:08:58Z</dc:date>
    <item>
      <title>Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213942#M16492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; background-color: rgba(248, 248, 248, 0.6);"&gt;I'm trying yo execute the RastertoPolygon conversion tool in ArcGIs 10.1. I'm executing it through a for loop, then it resulted to an error (Unable to open feature class Failed to execute (RasterToPolygon)) at the python console. As I checked for some output, the first raster from the list is successfully converted to shp file while the rest are not. Any suggestions? Note: (All of my rasters are already in integer data type)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; background-color: rgba(248, 248, 248, 0.6);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #222222;"&gt;#import the module&lt;BR /&gt;&amp;nbsp; import arcpy&lt;BR /&gt;&amp;nbsp; from arcpy.sa import *&lt;BR /&gt;&amp;nbsp; from arcpy import env&lt;BR /&gt;&amp;nbsp; arcpy.CheckOutExtension("Spatial")&lt;BR /&gt;&amp;nbsp; env.overwriteOutput = True&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; #set the workspace&lt;BR /&gt;&amp;nbsp; arcpy.env.workspace = r"C:\Users\Windows\Documents\JO_GIS_Analyst"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; #Get a list of rasters and convert to shapefile&lt;BR /&gt;&amp;nbsp; for raster in arcpy.ListRasters("nofpt*", "TIF"):&lt;BR /&gt;&amp;nbsp; print raster #check the presence of rasters"&lt;BR /&gt;&amp;nbsp; #convert the raster to polygon&lt;BR /&gt;&amp;nbsp; arcpy.RasterToPolygon_conversion(raster, raster +".shp", "SIMPLIFY")&lt;BR /&gt;&amp;nbsp; print "Finish converting the rasters to polygon"&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; background-color: rgba(248, 248, 248, 0.6);"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 10:46:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213942#M16492</guid>
      <dc:creator>RobertBeno</dc:creator>
      <dc:date>2014-08-11T10:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213943#M16493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;are these lines indented?&amp;nbsp; your code isn't formatted correctly if it isn't&lt;/P&gt;&lt;P&gt;print raster #check the presence of rasters"&lt;/P&gt;&lt;P&gt; #convert the raster to polygon&lt;/P&gt;&lt;P&gt; arcpy.RasterToPolygon_conversion(raster, raster +".shp", "SIMPLIFY")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 10:59:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213943#M16493</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-11T10:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213944#M16494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh, sorry for my formatting, yes my for loop is indented.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 11:08:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213944#M16494</guid>
      <dc:creator>RobertBeno</dc:creator>
      <dc:date>2014-08-11T11:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213945#M16495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, does it print the other raster names and just not produce anything?&amp;nbsp; if it prints the other names, have you looked on disk to confirm whether they are or are not there.&amp;nbsp; I am not sure about the wildcard you are using either, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 11:24:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213945#M16495</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-11T11:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213946#M16496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apparently the wildcard is working, assuming that the rasters of interest start with "nofpt" are TIF fiels and reside in the workspace indicated. &lt;/P&gt;&lt;P&gt;Some remarks:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;There is no need for spatial analyst to convert raster to polygons&lt;/LI&gt;&lt;LI&gt;With your code the output shapefile will have the name "nofpt&lt;EM&gt;_somename&lt;/EM&gt;&lt;SPAN style="color: #e23d39;"&gt;.tif&lt;/SPAN&gt;.shp". Not sure if you want that...&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the code below. This will remove the .tif extension from the output shapefile name (see line 9). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14077637201059660" jivemacro_uid="_14077637201059660"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#set the workspace&lt;/P&gt;
&lt;P&gt;arcpy.env.workspace = r"C:\Users\Windows\Documents\JO_GIS_Analyst"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Get a list of rasters and convert to shapefile&lt;/P&gt;
&lt;P&gt;for raster in arcpy.ListRasters("nofpt*", "TIF"):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp_name = "{0}.shp".format(os.path.splitext(raster)[0])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Converting raster '{0}' to polygons '{1}'".format(raster, shp_name)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #convert the raster to polygon&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RasterToPolygon_conversion(raster, shp_name, "SIMPLIFY")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;print "Finish converting the rasters to polygon"&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For testing you could comment out line 13 and see what it prints. How many rasters are found?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 13:34:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213946#M16496</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-08-11T13:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213947#M16497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you for this! Now, I've successfully converted my rasters. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 10:10:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213947#M16497</guid>
      <dc:creator>RobertBeno</dc:creator>
      <dc:date>2014-08-12T10:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to open feature class Failed to execute (RasterToPolygon)</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213948#M16498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great to hear you managed to solve your problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 12:24:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-open-feature-class-failed-to-execute/m-p/213948#M16498</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-08-12T12:24:10Z</dc:date>
    </item>
  </channel>
</rss>

