Issue Creating Points from Tuple List

480
1
04-21-2022 08:10 AM
JMarcel192
New Contributor II

Hi, 

_Maybe I'm too new to this but with a list of tuples, I should be able to create points. They are being created but it creates an incorrect location. The first image shows the first 25 tuple coordinates and a each item being read to show its type.

0d8664f2-ff89-4b6a-9087-2b7d9350c9c9.jpg

Here is the code at the moment: 

arcpy.AddMessage( topLine_Tuple[:25])
for i in topLine_Tuple[:25]:
arcpy.AddMessage(type(i))
arcpy.AddMessage(i)


# Creates an Empty Feature Class
topline_FC = arcpy.CreateFeatureclass_management(dataset_Dir, "topline0", "POINT")

# Cursor
with arcpy.da.InsertCursor(topline_FC, ['SHAPE@XY']) as insert_cursor:
for pnt in topLine_Tuple:
insert_cursor.insertRow([pnt])

 

...So it does create the points but all in the same coordinate (see next image). I'd figure that:

  1. the tuple list is incorrect, maybe an array
  2. the spatial reference is incorrect, it should be returning the feature class as NAD27 (spatial_reference=4267) or whichever
    1. Its initialing an UTM projection (most likely)
  3.  I dunno, since it should be returning different coordinates

Screenshot20220421-1913.jpg

by the way, all the points created result in the same long, lat (even though they are different in the tuple)

 

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

on the 4th line you have a double ]]

and then a bunch of singleton locations.  Remove one of the ] from that line and put it at the end of your point list


... sort of retired...
0 Kudos