Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 =

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 =
while new_row:
    new_row.setValue("Shape", newgeo)
    new_row =
row =
share|improve this question
9.3, 10, feature class... may I guess this is about that ArcGis thing? – Nicklas Avén Dec 30 '10 at 5:47
Yes, sorry I should have mentioned that. – amasephy Dec 30 '10 at 12:56
you should take caution using the ESRI id to grab matching features. There are many esri functions on any esri resource which will re-write the FID or OID or other internal esri ObjectID.… explains some of the basics about oids. and the following from edn… – Brad Nesom Dec 30 '10 at 15:22
I actually am using a "managed" ID that is used on the data and not the ESRI id your referring to. But thanks for the heads up. – amasephy Dec 30 '10 at 16:49
up vote 5 down vote accepted

You won't want to use the setValue method to set geometry. It should be:

new_row.shape = newgeo
new_row =
share|improve this answer
When I modified that line I get this error AttributeError: 'NoneType' object has no attribute 'Shape' – amasephy Dec 30 '10 at 14:40
A couple of things come to mind. First, try setting newgeo = row.shape in the top part of your script. Second, are you setting your geoprocessor object to run against 9.3 (gp = arcgisscripting.create(9.3))? – user890 Dec 30 '10 at 15:06
the newgeo = row.shape worked perfectly. There is also a typo in my original code.. for new_row = it should be new_row = Thanks to everyone for the help! – amasephy Dec 30 '10 at 15:34

Your Answer


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.