<?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: converting a feature class to numpy array? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065453#M61299</link>
    <description>&lt;P&gt;&amp;nbsp;A little gander at the help topic will give you some suggestions regarding the shape and id fields&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/featureclasstonumpyarray.htm" target="_blank" rel="noopener"&gt;FeatureClassToNumPyArray—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arr = arcpy.da.FeatureClassToNumPyArray(fc, ["OID@", "SHAPE@X", "SHAPE@Y", "Blah"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Addendum&lt;/P&gt;&lt;P&gt;Even if you convert the vector to an array, at best you will get the points forming the perimeter of the polygon and not the intervening space.&amp;nbsp; If you want to work with the raster and the polygon, then convert the polygon to raster, then use RasterToNumPyArray for both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Jun 2021 20:15:36 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-06-06T20:15:36Z</dc:date>
    <item>
      <title>converting a feature class to numpy array?</title>
      <link>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065444#M61298</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a raster layer and a feature class that I need to combine. I have been advised that the best way to do this would be through numpy arrays.&lt;/P&gt;&lt;P&gt;converting the raster layer was simple enough&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;rast_nparr = arcpy.RasterToNumPyArray("UKJstdRM")&lt;/LI-CODE&gt;&lt;P&gt;however i'm having real trouble getting the feature class to convert. I should make it obvious this is my first time using the library so i don't really understand how it works so this might be a very simple fix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;at first I thought it was because everything was contained in a layer file and not a feature class&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;feature_class = arcpy.CopyFeatures_management("UKJ_areas.lyr", "UKJ_FC")
fet_nparr = arcpy.da.FeatureClassToNumPyArray (feature_class, ["Shape","objectid","nuts315cd","nuts315nm","MEAN_parti"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however when I run this code i get an error indicating that "a column was specified that does not exist"&lt;/P&gt;&lt;P&gt;i've tried removing some columns to try and fix the issue with no luck so i'm assuming i'm using the functions wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 14:33:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065444#M61298</guid>
      <dc:creator>DanielFuller</dc:creator>
      <dc:date>2021-06-06T14:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: converting a feature class to numpy array?</title>
      <link>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065453#M61299</link>
      <description>&lt;P&gt;&amp;nbsp;A little gander at the help topic will give you some suggestions regarding the shape and id fields&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/featureclasstonumpyarray.htm" target="_blank" rel="noopener"&gt;FeatureClassToNumPyArray—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arr = arcpy.da.FeatureClassToNumPyArray(fc, ["OID@", "SHAPE@X", "SHAPE@Y", "Blah"])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Addendum&lt;/P&gt;&lt;P&gt;Even if you convert the vector to an array, at best you will get the points forming the perimeter of the polygon and not the intervening space.&amp;nbsp; If you want to work with the raster and the polygon, then convert the polygon to raster, then use RasterToNumPyArray for both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 20:15:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065453#M61299</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-06-06T20:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: converting a feature class to numpy array?</title>
      <link>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065454#M61300</link>
      <description>&lt;P&gt;What do you mean when you say "&lt;SPAN&gt;I have a raster layer and a feature class that I need to &lt;STRONG&gt;combine&lt;/STRONG&gt;&lt;/SPAN&gt;"? Do you want to create a statistics (SUM, MEAN, MAX, etc.) or create a unique combination of the Raster and a Field value(s) of Feature Class?&lt;/P&gt;&lt;P&gt;Converting the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/polygon-to-raster.htm" target="_self"&gt;Vector to Raster&lt;/A&gt; (using desired value field) could be an option. Keep the Cell size and Snap Raster setting as your Raster layer.&lt;/P&gt;&lt;P&gt;Using the above output Raster with your original Raster layer, you could do a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/raster-calculator.htm" target="_self"&gt;Raster Calculation&lt;/A&gt; as desired.&lt;/P&gt;&lt;P&gt;* I am assuming that you have an ArcGIS Desktop Advanced + Spatial Analyst extension License.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 16:27:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/converting-a-feature-class-to-numpy-array/m-p/1065454#M61300</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2021-06-06T16:27:14Z</dc:date>
    </item>
  </channel>
</rss>

