Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have two feature classes which have common Valve ID #s. One table has multiple service connections with a unique number. I need to select all services linked to each valve and collect the individual service # then update the service fields (1-4) in the Valve class with each connection #. I believe I can do it with an updateCursor but I'm not a strong coder. Any help is appreciated.

share|improve this question
add comment

1 Answer 1

    import arcpy, sys, string, os   
    valve = r"C:\valves.shp"
    services = r"C:\serviceConnectors.shp"
    fieldname1 = "ValveID"
    fieldname2 = "ConnectorServiceID"
    ucur = arcpy.UpdateCursor(valve)
    for urow in ucur:
        connectorlist = []
        valveid = ucur.GetValue(fieldname)
        sql = fieldname + " = " + valveid#This syntax probably won't work
        scur = arcpy.SearchCursor(services, sql)
        for srow in scur:
            connectorvalue = srow.GetValue(fieldname2)
            connectorlist.append(connectorvalue)

This should get you started. You'll have to give more info on how you want the fields updated to add to the algorithm.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.