0

I'm not getting any errors but can't seem to get these rows added. Everything else in the script works fine. I only dabble with Python occasionally so please forgive me for missing anything obvious

new_rows = [(centpointX, centpointY, distance, TRangle),
            (centpointX, centpointY, distance, LRangle)]
cursor = arcpy.da.InsertCursor(pointshap,
                           ['xfield', 'yfield', 'distance', 'bearing'])
for row in new_rows:
    cursor.insertRow(row)
del cursor 
  • Are you getting errors or the data just isn't getting inserted? – Chad Cooper Jun 23 '16 at 18:04
4

You are trying to add your point X/Y data as field values rather than to SHAPE.

Include your X/Y as tuple in new_rows, and add them into SHAPE@XY with your Insert Cursor

new_rows = [((centpointX, centpointY), distance, TRangle),
            ((centpointX, centpointY), distance, LRangle)]
cursor = arcpy.da.InsertCursor(pointshap,
                           ['SHAPE@XY', 'distance', 'bearing'])
for row in new_rows:
    cursor.insertRow(row)
del cursor 

See Insert Cursor - ArcGIS Desktop Help. The Syntax section on that page describes the SHAPE@XY, and further down the second Code Sample has an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.