mpa = gp.GetParameter(0) # get the id and name from first record if set cur = gp.SearchCursor(mpa) row = cur.next() MPAName = row.MPAName mpaid = row.mpaid del row,cur if MPAName == None and mpaid == None : MPAName = "MPA" mpaid = 0 elif mpaid > 0 and MPAName == None: MPAName = "MPA"+str(mpaid) elif mpaid == None and MPAName != None : # keep override name mpaid = int(MPAName[3:]) else : gp.AddWarning(MPAName) gp.AddWarning(mpaid) # rename all parts with a unique name for a dissolve # increments to highest number or blank or zero if not gp.Exists("MPA") : gp.CopyFeatures("template_mpa","MPA") if not gp.Exists("MPA0") : gp.CopyFeatures("template_mpa","MPA0") fcName = gp.CreateUniqueName(MPAName,ws) fcName = os.path.basename(fcName) MPAName = fcName # update mpaid = int(MPAName[3:]) ## gp.AddWarning(str(mpaid)+" "+MPAName) cur = gp.UpdateCursor(mpa) row = cur.next() while row: row.MPAName = fcName row.mpaid = mpaid cur.updateRow(row) row = cur.next() del row,cur
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.