Run a gp.Describe(layer) and you can get out the Layer properties FIDSet. This is a clumsy string of all the FIDs that are in the selection. But it enables you to get a list of which features are selected.
DICT_VALUES = {'Tak': 'T', 'Nie': 'F', 'Bez zmian': None} def updateDb(cur, field, value, teryts): update_string = "Update PLOTS set " + str(field) + " = '" + str(value) + "' where TERYT = :teryt" cur.prepare(update_string) for teryt in teryts: arcpy.AddMessage('Setting ' + field + ' to ' + value + ' for plot ' + teryt) cur.execute(None, {'teryt': str(teryt)}) con.commit() import arcpy import sys try: import cx_Oracle as cxo except ImportError: arcpy.AddError('cx_Oracle module not found. Add module to sys.path or install module if necessary') sys.exit() plots = sys.argv[1] arcpy.AddMessage('Processing selection') rows = arcpy.SearchCursor(plots) teryt_nr = [] for plot in rows: if plot.TERYT: teryt_nr.append(plot.TERYT) arcpy.AddMessage('Connecting to DB...') con = cxo.connect('user/pass@db') cur = con.cursor() # ## POI if DICT_VALUES[sys.argv[2]]: updateDb(cur, 'POI', DICT_VALUES[sys.argv[2]], teryt_nr)
fc = "parcels" rows = arcpy.UpdateCursor(fc, "Area1 = 10") for row in rows: row.Area2 = 200 rows.updateRow(row)
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.