<?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 Working with Numpy Arrays in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/working-with-numpy-arrays/m-p/362956#M28698</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a numpy array like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import numpy as np

np.array([('1', [[0.0, 0.0], [1.0, 0.0], [0.30901699437494745, 0.95105651629515353], [-0.80901699437494734, 0.58778525229247325], [-0.80901699437494756, -0.58778525229247303], [0.0, 0.0]]),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('2', [[0.0, 0.0], [-0.80901699437494756, -0.58778525229247303], [0.30901699437494723, -0.95105651629515364], [1.0, -2.4492935982947064e-16], [1.0, 0.0], [0.0, 0.0]])], 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtype=[('UniqueID', 'S4'), ('XY', '&amp;lt;f8', (6, 2))])
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to convert this array into a feature class using the 10.1 arcpy.da.NumPyArrayToFeatureClass function. However, feeding this array into the arcpy function gives me two points at (0,0), representing the first coordinate pairs in UniqueID 1 and 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts on what might be the problem? Each UniqueID relates to a tuple of coordinate pairs that should be connected to form a closed polygon (last point is the same as the first point).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Dec 2012 03:28:22 GMT</pubDate>
    <dc:creator>MichaelMarkieta</dc:creator>
    <dc:date>2012-12-27T03:28:22Z</dc:date>
    <item>
      <title>Working with Numpy Arrays</title>
      <link>https://community.esri.com/t5/python-questions/working-with-numpy-arrays/m-p/362956#M28698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a numpy array like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import numpy as np

np.array([('1', [[0.0, 0.0], [1.0, 0.0], [0.30901699437494745, 0.95105651629515353], [-0.80901699437494734, 0.58778525229247325], [-0.80901699437494756, -0.58778525229247303], [0.0, 0.0]]),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('2', [[0.0, 0.0], [-0.80901699437494756, -0.58778525229247303], [0.30901699437494723, -0.95105651629515364], [1.0, -2.4492935982947064e-16], [1.0, 0.0], [0.0, 0.0]])], 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dtype=[('UniqueID', 'S4'), ('XY', '&amp;lt;f8', (6, 2))])
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to convert this array into a feature class using the 10.1 arcpy.da.NumPyArrayToFeatureClass function. However, feeding this array into the arcpy function gives me two points at (0,0), representing the first coordinate pairs in UniqueID 1 and 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts on what might be the problem? Each UniqueID relates to a tuple of coordinate pairs that should be connected to form a closed polygon (last point is the same as the first point).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 03:28:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-numpy-arrays/m-p/362956#M28698</guid>
      <dc:creator>MichaelMarkieta</dc:creator>
      <dc:date>2012-12-27T03:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Numpy Arrays</title>
      <link>https://community.esri.com/t5/python-questions/working-with-numpy-arrays/m-p/362957#M28699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is basically taken exactly from the help, without using numpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

# A list of features and coordinate pairs
#
coordList = [[[0.0, 0.0], [1.0, 0.0], [0.30901699437494745, 0.95105651629515353], [-0.80901699437494734, 0.58778525229247325], [-0.80901699437494756, -0.58778525229247303], [0.0, 0.0]],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [[0.0, 0.0], [-0.80901699437494756, -0.58778525229247303], [0.30901699437494723, -0.95105651629515364], [1.0, -2.4492935982947064], [1.0, 0.0], [0.0, 0.0]]]


# Create empty Point and Array objects
#
point = arcpy.Point()
array = arcpy.Array()

# A list that will hold each of the polygon objects 
# 
featureList = []

for feature in coordList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # For each coordinate pair, set the x,y properties and add to the 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp; Array object.
&amp;nbsp;&amp;nbsp;&amp;nbsp; #
&amp;nbsp;&amp;nbsp;&amp;nbsp; for coordPair in feature:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point.X = coordPair[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point.Y = coordPair[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(point)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a polygon object based on the array of points
&amp;nbsp;&amp;nbsp;&amp;nbsp; #
&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Clear the array for future use
&amp;nbsp;&amp;nbsp;&amp;nbsp; #
&amp;nbsp;&amp;nbsp;&amp;nbsp; array.removeAll()

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Append to the list of polygon objects
&amp;nbsp;&amp;nbsp;&amp;nbsp; #
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureList.append(polygon)

# Create a copy of the polygon objects, by using featureList as input to 
#&amp;nbsp; the CopyFeatures tool.
#
arcpy.CopyFeatures_management(featureList, "C:/outputFOlder/PolygonArray")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:55:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-numpy-arrays/m-p/362957#M28699</guid>
      <dc:creator>CarlSunderman</dc:creator>
      <dc:date>2021-12-11T16:55:29Z</dc:date>
    </item>
  </channel>
</rss>

