I am making a python code for arcgis 9.3. In this code i create a new point with x,y and z attributes as following :

rowsLine = gp.updatecursor(line_Feature_Class)
rowLine = rowsLine.next()

rowsPoint = gp.InsertCursor(point_Feature_Class)
feat = rowsPoint.NewRow()

while rowLine:


    ptObj = gp.CreateObject('Point')
    ptObj.x = xPremierPoint
    ptObj.y = yPremierPoint
    ptObj.z = zPremierPoint
    feat.Shape = ptObj

I want to add the z value in a field "zvalue" in my "point_Feature_Class". The problem is i can't use an insert cursor (rowsPoint) and an update cursor at the same time.

So, at the end of the code, I want to delete the insert cursor, create an upsdate cursor, to loop in my "point_Feature_Class" and get the z attribute of each point and add it in the fiels "zvalue".

The code should be something like that :

rows = gp.updatecursor(point_Feature_Class)
row = rows.next()

While row :

    Zvalue = #???? row.shape.getz ????
    row.SetValue("zvalue", Zvalue)

row = rows.Next()

Thanks for your help ;)


You can get it this way:


And here you can get more information and a complete example from the ArcGIS Desktop Help.

  • Thanks for the answer ! Now i have a new problem : The value return by this line is 1.#QNAN. It means that no value is set to point.z while i set the vaue prviously : ptObj.z = zPremierPoint. And if i try with .x, it works ! – Panvjim0 Apr 14 '14 at 11:39
  • 1
    Does your feature class allows Z values? – cag Apr 14 '14 at 12:18
  • Actually no ^^^I changed it and it's work. – Panvjim0 Apr 14 '14 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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