Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

moving attributes from one table to another based on selection

$
0
0
I am trying to move through my contractBuffer layer record by record. For each record I want to select the culverts from the culvert_subset that fall within that record. Then take the value from the GWP field from my contractBuffer layer and populate the GWP field in the culvert subset for all those that fall within that first record. Then move to the second record in the contract buffer layer select all the culverts that fall within and so on.
I know that I need to be using searchcursor and updatecursor.
I think this is close to what I need to be doing however I am not sure and know that I am missing pieces. If anybody could help or make suggestions that would be great!! Thank you!

Code:

import arcpy

 Srlist = []

 rows = arcpy.SearchCursor("Contract_Buff")
 row = rows.next()
 
 while row:
    Srlist.append(row.getValue("GWP"))
    row = rows.next()
 
 Cul_rows = arcpy.UpdateCursor("Culvert_subset",GWP)

 while Cul_row:
    for Cul_row in Cul_rows:
                (i think this is where my query needs to go to select only those culverts that fall within the boundary of the first record in the contract buff...not sure how)
       
                row.updateRow(row)
        Cul_row = Cul_rows.next()


Viewing all articles
Browse latest Browse all 2485

Trending Articles