<?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: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster). in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171853#M54902</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;top marks for you! Stupidly I was linking to the value not the field in the value variable of the tool 🤦thank you.&lt;/P&gt;&lt;P&gt;Will test shortly and revert. I'm hoping it does work on a feature by feature basis, as that's the purpose of my script. It's to create a feature class of points, with values and spacings that match the max height of each tree group feature.&lt;/P&gt;</description>
    <pubDate>Mon, 09 May 2022 06:06:52 GMT</pubDate>
    <dc:creator>David_Brooks</dc:creator>
    <dc:date>2022-05-09T06:06:52Z</dc:date>
    <item>
      <title>Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171813#M54898</link>
      <description>&lt;P&gt;I've got the following script to loop through a&amp;nbsp; polygon dataset, but I keep getting a strange error that I can't fathom.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR 000728:&lt;SPAN class=""&gt; Field 10 does not exist within table
Failed to execute (PolygonToRaster).&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I don't have a "Field 10" so im not sure why the PolyToRas tool is trying to access it.&lt;/P&gt;&lt;P&gt;Here's the script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# for loop to loop through each "group_extent" polygon in turn and create shadow polygons
with arcpy.da.SearchCursor(group_extent,['SHAPE@', 'GroupRef', 'Species', 'MaxHeight']) as cursor:
   groupCount = 0
   for fc in cursor:
      # variables
      shadowRas = "shadowRas"
      shadowPnts = "memory\shadowPnts"
      shadowPntsJoined = "memory\shadowPntsJoined"
      cellsize = fc[3]      
      # polygon to raster
      arcpy.conversion.PolygonToRaster(fc[0], cellsize, shadowRas, "CELL_CENTER", "NONE", cellsize, "DO_NOT_BUILD")
      # raster to point
      arcpy.conversion.RasterToPoint(shadowRas, shadowPnts, "Value")
      arcpy.management.DeleteFeatures(shadowRas)
      # join group data back to shadowPnts
      arcpy.analysis.SpatialJoin(shadowPnts, group_extent, shadowPntsJoined)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas what's going on?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 06:07:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171813#M54898</guid>
      <dc:creator>David_Brooks</dc:creator>
      <dc:date>2022-05-09T06:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171850#M54901</link>
      <description>&lt;P&gt;This is the tool's signature and your call:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.conversion.PolygonToRaster(in_features, value_field, out_rasterdataset, {cell_assignment}, {priority_field}, {cellsize}, {build_rat})

arcpy.conversion.PolygonToRaster(fc[0], cellsize, shadowRas, "CELL_CENTER", "NONE", cellsize, "DO_NOT_BUILD")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're using cellsize as value field name. Previously, you assigned the value of MaxHeight to cellsize. In the first feature, the MaxHeight field probably has the value 10, so the tool is trying to access field 10. You should use the actual field name, not the value.&lt;/P&gt;&lt;P&gt;Also, not sure, but I think this only works on feature classes, not singular features?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 05:54:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171850#M54901</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-09T05:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171853#M54902</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;top marks for you! Stupidly I was linking to the value not the field in the value variable of the tool 🤦thank you.&lt;/P&gt;&lt;P&gt;Will test shortly and revert. I'm hoping it does work on a feature by feature basis, as that's the purpose of my script. It's to create a feature class of points, with values and spacings that match the max height of each tree group feature.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 06:06:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171853#M54902</guid>
      <dc:creator>David_Brooks</dc:creator>
      <dc:date>2022-05-09T06:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171869#M54904</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;so im looking at how to call the field name MaxHeight in the conversion gp tool. Am i right in thinking that i need to define a new memory feature class with the feature added to it, and then run on that, and delete at the end of the loop?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 08:28:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171869#M54904</guid>
      <dc:creator>David_Brooks</dc:creator>
      <dc:date>2022-05-09T08:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171871#M54905</link>
      <description>&lt;P&gt;I think so, yes.&lt;/P&gt;&lt;P&gt;Create a memory fc, add the field, insert the current feature (shape and maxheight), run the tool, delet the fc.&lt;/P&gt;&lt;P&gt;Depending on your feature count, it might be faster to create the memory fc outside of the loop and truncate instead of delete.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 08:47:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171871#M54905</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-09T08:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171873#M54906</link>
      <description>&lt;P&gt;Huh, seems you can't truncate tables in memory, because you're not the data owner...&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.management.DeleteRows(memory_table)&lt;/STRONG&gt; works, though.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 08:50:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171873#M54906</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-09T08:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171877#M54908</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;thank you. but do i need an insertcursor to add the searchcursor object to the feature class?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 08:58:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171877#M54908</guid>
      <dc:creator>David_Brooks</dc:creator>
      <dc:date>2022-05-09T08:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171884#M54909</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# for loop to loop through each "group_extent" polygon in turn and create shadow polygons
with arcpy.da.SearchCursor(group_extent,['SHAPE@', 'GroupRef', 'Species', 'MaxHeight']) as cursor:
   groupCount = 0
   for shp, groupRef, species, maxHeight in cursor:
      # variables
      memFC = "memory/FC"    
      shadowRas = "shadowRas"
      shadowPnts = "memory\shadowPnts"
      shadowPntsJoined = "memory\shadowPntsJoined"
      # copy the current feature into a memory feature class
      arcpy.management.CreateFeatureclass("memory", "FC", "POLYGON", spatial_reference=shp.spatialReference)
      arcpy.management.AddField(memFC, "ValueField", "FLOAT")
      with arcpy.da.InsertCursor(memFC, ["SHAPE@", "ValueField"]) as icursor:
         icursor.insertRow([shp, maxHeight])
      # polygon to raster
      arcpy.conversion.PolygonToRaster(memFC, "ValueField", shadowRas, "CELL_CENTER", "NONE", cellsize, "DO_NOT_BUILD")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 May 2022 09:11:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1171884#M54909</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-09T09:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1172191#M54952</link>
      <description>&lt;P&gt;Another option is to loop through and select by attribute or make feature layer with a where clause&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# for loop to loop through each "group_extent" polygon in turn and create shadow polygons
oidname = arcpy.da.Describe(group_extent)["OIDFieldName"]
with arcpy.da.SearchCursor(group_extent, ['OID@']) as cursor:
   groupCount = 0
   for oid in cursor:
      # variables
      grp_lyr = arcpy.management.MakeFeatureLayer(group_extent, "temp_group",  f"{oidname} = {oid}")[0]
      shadowRas = "shadowRas"
      shadowPnts = "memory\shadowPnts"
      shadowPntsJoined = "memory\shadowPntsJoined"
      # polygon to raster
      arcpy.conversion.PolygonToRaster(grp_lyr, "MaxHeight", shadowRas, "CELL_CENTER", "NONE", cellsize, "DO_NOT_BUILD")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 21:11:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1172191#M54952</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-05-09T21:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1172284#M54966</link>
      <description>&lt;P&gt;That is indeed a far better and cleaner way...&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 05:40:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1172284#M54966</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-10T05:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy problem: ERROR 000728: Field 10 does not exist within table Failed to execute (PolygonToRaster).</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1173383#M55093</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10780"&gt;@Luke_Pinner&lt;/a&gt;&amp;nbsp;thank you both. Excellent suggestions. Have implemented Johannes solution with success &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 15:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-problem-error-000728-field-10-does-not-exist/m-p/1173383#M55093</guid>
      <dc:creator>David_Brooks</dc:creator>
      <dc:date>2022-05-12T15:41:55Z</dc:date>
    </item>
  </channel>
</rss>

