I have two shapefiles: "broken_cities" and "us_cities." "us_cities" contains point data representing cities in the US, and the x and y coordinates are correct. "broken_cities" contains point data representing 10 cities in the US whose X and Y coordinates are incorrect. There is no X and Y coordinate fields in the attribute table of either.
The goal is to update the broken cities X and Y coordinates using the correct coordinates from "us_cities." I know I should use an update cursor, but I don't know how to combine the search cursor and the update cursor. I am aware that my code does not work at all because I'm not sure of the logic of the workflow. Thanks in advance for any advice.
import arcpy
#set workspace
arcpy.env.workspace= r"Y:\Personal\jsmith\EGData.gdb"
fields=["OID@", "SHAPE@X", "SHAPE@Y"] #tokens to access
#create search cursors to look at values
broken_scur=arcpy.da.SearchCursor("cities_broken",fields)
cities_scur=arcpy.da.SearchCursor("us_cities", fields)
#OIDs of the 10 broken cities
broken_city_OIDs=[66, 68, 61, 74, 86, 80, 116, 94, 96, 97]
for row in cities_scur:
for row1 in broken_scur:
if row1[0]==broken_city_OIDs:
row1[1]==row[1]
row1[2]==row[2]