I'm looking to update the point geometry of lets say "oldFC" by obtaining the shape geometry of "newFC" and applying that to the "oldFC". I also want it to grab the value in the ID field in "newFC"and use that to search for the same ID in "oldFC" and then set the shape value.
I believe I have the loop set up and it appears to be grabbing the ID just fine but it doesn't update the shape geometry.
I'm very much a beginner with using Python so my code is rough.
Here's the code snippet… running 9.3 (no access to 10):
rows = gp.SearchCursor(newFC):
row = rows.next()
gp.MakeFeatureLayer_management(oldFC, oldLayer, "")
gp.MakeFeatureLayer_management(newFC, newLayer, "")
while row:
newgeo = row.getValue("Shape")
newID = row.getValue("ID")
print newgeo
print newID
where = "ID" + '= ' + str(newID) #my sql expression
print where
new_rows = gp.UpdateCursor(oldFC, where)
new_row = rows.next()
while new_row:
new_row.setValue("Shape", newgeo)
new_rows.UpdateRow(new_row)
new_row = new_rows.next()
row = rows.next()
Best Answer
You won't want to use the setValue method to set geometry. It should be: