fc = "Points" sr = arcpy.SpatialReference(3032) with arcpy.da.UpdateCursor(fc, ["SHAPE@XY", "XCOORD", "YCOORD"], "", sr) as cursor: for row in cursor: row[1] = row[0][0] row[2] = row[0][1] cursor.updateRow(row) del row, cursor
Hi Alice,You can do this using the UpdateCursor. You can specify a coordinate system that's in meters. Ex:fc = "Points" sr = arcpy.SpatialReference(3032) with arcpy.da.UpdateCursor(fc, ["SHAPE@XY", "XCOORD", "YCOORD"], "", sr) as cursor: for row in cursor: row[1] = row[0][0] row[2] = row[0][1] cursor.updateRow(row) del row, cursorYou can find the code of your coordinate system within the data frame properties > Coordinate System tab:[ATTACH=CONFIG]30312[/ATTACH]
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.