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)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.