import arcpy arcpy.env.workspace = "**************" outline = "***********testoutline7.shp" fields = ['SHAPE@XY'] with arcpy.da.SearchCursor(outline, fields) as cursor: for row in cursor: coordX = row[0][0] if coordX < 0: coordX = coordX + 360 coordY = row[0][1] print "X: {}, Y: {}".format(coordX,coordY) #----transformation of the centroid-coordinates---# Xrnd = round(coordX, 3) longitude = str(Xrnd) glimsLongitude = longitude.split('.') Yrnd = round(coordY, 3) latitude = str(Yrnd) glimsLatitude = latitude.split('.') #-----------------------------------------# with arcpy.da.UpdateCursor(outline, "GLIMS_ID") as crsr: for glims in crsr: glims[0] = "G" + glimsLongitude[0] + glimsLongitude[1] + "E" + glimsLatitude[0] + glimsLatitude[1] + "N" crsr.updateRow(glims)
Solved! Go to Solution.
At a quick glance, you're looping through your SearchCursor, and within that SearchCursor you're looping through the UpdateCursor. So each time through the Search loop, you're updating all your data with the same set of data, the one row, of search results. If three loops through your SearchCursor returned a, b, c, respectively, your UpdateCursor then populates your field with all a's, then all b's, then all c's, respectively.