<?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: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077548#M61696</link>
    <description>&lt;P&gt;ps....&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-blog/point-tools-for-pro/ba-p/904043" target="_blank"&gt;Point Tools for Pro - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;has "spaced points"&lt;/P&gt;&lt;P&gt;which would probably do it... you can use it or examine the code with the toolbox to get more familiar with working with numpy...&amp;nbsp; you might become a "numpathian pythonista"&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jul 2021 02:41:21 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-07-11T02:41:21Z</dc:date>
    <item>
      <title>Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077536#M61690</link>
      <description>&lt;P&gt;&amp;nbsp;Hello &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to create random points. I was using the function to do this in ArcGIS but I got a problem. I can´t define a maximum distance among points.&lt;/P&gt;&lt;P&gt;I am trying to do so, starting with a fishnet points layer. I add fields that hold the values of the coordinates plus a random number between a minimum and a maximum.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works well.&lt;/P&gt;&lt;P&gt;However, I run into problems trying to create a new points layer. I used&amp;nbsp; "FeatureClassToNumPyArray" and "NumPyArrayToFeatureClass" trying to replace&amp;nbsp;the original &lt;A href="mailto:shape@XY" target="_blank"&gt;shape@XY&lt;/A&gt;&amp;nbsp;with the displaced points. I get this error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
In  [104]:
Line 94:    arcpy.da.NumPyArrayToFeatureClass(arr_random_points, Vpc,("RX","RY"))

RuntimeError: invalid table name
---------------------------------------------------------------------------&lt;/LI-CODE&gt;&lt;P&gt;I do not understand why the array is not valid. Is there something wrong in my code?&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Creation of Random Points from a Fishnet inside a rectangle

vOx=arr_poly["OX"][0]

vOy=arr_poly["OY"][0]

vMx=arr_poly["MX"][0]

vMy=arr_poly["MY"][0]


Orig_coord=str(vOx) + " " + str(vOy)

print(Orig_coord)

Y_axis_c=str(vOx) + " " + str(vMy)

print(Y_axis_c)


arcpy.management.CreateFishnet("Fishnet_feat",Orig_coord,Y_axis_c,0.5,0.5,"","","","LABELS",Boundary_polygon,"POLYGON")

arcpy.management.AddFields(
    "Fishnet_feat_label",
    [['X', 'DOUBLE', 'X', "10", "2",""], 
     ['Y', 'DOUBLE', 'Y', "10","2",""],
	 ['RX', 'DOUBLE', 'RX', "10","","2"],
	 ['RY', 'DOUBLE', 'RY', "10","2",""],
	 ["New_Shape","TEXT","New_Shape",50,""]])

arcpy.management.CalculateGeometryAttributes("Fishnet_feat_label", [["X", "POINT_X"], ["Y", "POINT_Y"]])

arcpy.management.CalculateFields("Fishnet_feat_label", expression_type="PYTHON3", fields=[["RX", "round(!X! + random.uniform(0,0.9),2)"], ["RY", "round(!Y! + random.uniform(0,0.9),2)"], ["New_Shape", "str(!RX!) +\",\" + str(!RY!)"]], code_block="import random")


arr_random_points= arcpy.da.FeatureClassToNumPyArray("Fishnet_feat_label",["*"])


Vpc="test.shp"



arcpy.da.NumPyArrayToFeatureClass(arr_random_points, Vpc,("RX","RY"))

Print(Vpc)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jul 2021 23:07:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077536#M61690</guid>
      <dc:creator>mlopezr95984</dc:creator>
      <dc:date>2021-07-10T23:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077537#M61691</link>
      <description>&lt;P&gt;show a couple of rows of the array and its dtype&lt;/P&gt;&lt;P&gt;ie&lt;/P&gt;&lt;P&gt;yourarray[:5]&lt;/P&gt;&lt;P&gt;will provide both (obviously yourarray is your array&lt;/P&gt;&lt;P&gt;check your origin point as well for the featureclass to be constructed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jul 2021 23:15:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077537#M61691</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-10T23:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077542#M61692</link>
      <description>&lt;P&gt;Hi Dan, thank you,&amp;nbsp; these are some of the rows of the array:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;print(arr_random_points[:5])

[(1, [-3.29999998e-01, -1.77633000e+03], -0.33, -1776.33, -0.21, -1776.14, '-0.21,-1776.14')
 (2, [ 1.70000002e-01, -1.77633000e+03],  0.17, -1776.33,  0.39, -1775.56, '0.39,-1775.56')
 (3, [ 6.70000002e-01, -1.77633000e+03],  0.67, -1776.33,  0.78, -1775.92, '0.78,-1775.92')
 (4, [ 1.17000000e+00, -1.77633000e+03],  1.17, -1776.33,  1.28, -1775.71, '1.28,-1775.71')
 (5, [ 1.67000000e+00, -1.77633000e+03],  1.67, -1776.33,  1.75, -1775.65, '1.75,-1775.65')]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The origin point comes from a rectangle. The fishnet looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fishnet.JPG" style="width: 683px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18165i5BEBF9B22E304765/image-dimensions/683x356?v=v2" width="683" height="356" role="button" title="fishnet.JPG" alt="fishnet.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I did not define dtypes....&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jul 2021 01:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077542#M61692</guid>
      <dc:creator>mlopezr95984</dc:creator>
      <dc:date>2021-07-11T01:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077544#M61693</link>
      <description>&lt;P&gt;using &lt;A href="mailto:shape@XY" target="_blank"&gt;shape@XY&lt;/A&gt;&amp;nbsp;is ok but a pain,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SR = ???&amp;nbsp; &amp;nbsp; # specify your spatial reference or geometry will be "off-ish" .... long story&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;arr = arcpy.da.FeatureClassToNumPyArray(...your featureclass..., (&lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;'OID@'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;'SHAPE@X'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class="hljs-string"&gt;'SHAPE@Y', whatever&lt;/SPAN&gt;&lt;SPAN&gt;), spatial_reference=SR)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then when you get "arr"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;print(arr.dtype)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;print(arr[:5])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There has to be a dtype since the objectid (OID@) is integer and some are float and some text(??)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jul 2021 01:28:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077544#M61693</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-11T01:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077546#M61694</link>
      <description>&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;Indeed, the dtype is as follows. I guess it comes from the feature class?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[('OID', '&amp;lt;i4'), ('Shape', '&amp;lt;f8', (2,)), ('X', '&amp;lt;f8'), ('Y', '&amp;lt;f8'), ('RX', '&amp;lt;f8'), ('RY', '&amp;lt;f8'), ('New_Shape', '&amp;lt;U50')]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[('OID', '&amp;lt;i4'), ('Shape', '&amp;lt;f8', (2,)), ('X', '&amp;lt;f8'), ('Y', '&amp;lt;f8'), ('RX', '&amp;lt;f8'), ('RY', '&amp;lt;f8'), ('New_Shape', '&amp;lt;U50')]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jul 2021 02:24:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077546#M61694</guid>
      <dc:creator>mlopezr95984</dc:creator>
      <dc:date>2021-07-11T02:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077547#M61695</link>
      <description>&lt;P&gt;As I suggested, skip &lt;A href="mailto:SHAPE@XY," target="_blank"&gt;SHAPE@XY,&lt;/A&gt;&amp;nbsp;it is a nested pair of coordinates, ... anyway...&lt;/P&gt;&lt;P&gt;NumPyArrayToFeatureClass (in_array, out_table, shape_fields, {spatial_reference})&lt;/P&gt;&lt;P&gt;out_table : your output featureclass... full path, raw encoded (eg r"c:\path_to\your.gdb\new_pnts")&lt;/P&gt;&lt;P&gt;shape_fields :&amp;nbsp; if X and Y are your new points or 'RX, RY' are, specify those like ('X', 'Y') in brackets&lt;/P&gt;&lt;P&gt;Spatial reference .... make sure you use one!!!, you have been warned &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jul 2021 02:35:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077547#M61695</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-11T02:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077548#M61696</link>
      <description>&lt;P&gt;ps....&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-blog/point-tools-for-pro/ba-p/904043" target="_blank"&gt;Point Tools for Pro - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;has "spaced points"&lt;/P&gt;&lt;P&gt;which would probably do it... you can use it or examine the code with the toolbox to get more familiar with working with numpy...&amp;nbsp; you might become a "numpathian pythonista"&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jul 2021 02:41:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077548#M61696</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-11T02:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using NumPyArrayToFeatureClass to modify coordinates of a points layer</title>
      <link>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077600#M61697</link>
      <description>&lt;P&gt;Thank you Dan! I, for sure, want to become a "numpathian pythonista" &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jul 2021 18:52:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-using-numpyarraytofeatureclass-to-modify/m-p/1077600#M61697</guid>
      <dc:creator>mlopezr95984</dc:creator>
      <dc:date>2021-07-11T18:52:18Z</dc:date>
    </item>
  </channel>
</rss>

