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 currently working on some scripts with 3D polygons using arcpy (arcgis10). Reading and data manupulation works fine, however writing the output back into a shapefile doesn't seem to work, it only generated 2D files. for writing i use the following function:

import arcpy    
def write_new_MP(data,outfile):
        array = arcpy.Array()
        point = arcpy.Point()
        for feature in data:
            for part in feature:         
        arcpy.CopyFeatures_management(features, outfile,"", "0", "0", "0")

the data is a list likedata=[[[5,5,5],[10,5,5],[10,10,5],[5,10,5],[5,5,5]],[[15,15,15],[10,15,15],[10,10,15],[15,10,15],[15,15,15]]]

Does somebody know why the Z-values aren't used when generating the output?

share|improve this question
How have you confirmed that the Z isn't written to the file? Are you viewing this in the 3D analyst? – Dan Patterson Jun 15 '11 at 15:14
by viewing in arcscene, all objects appear flat no matter what z-data is written – Paul Jun 16 '11 at 7:29
Depending on your data you might also need to include another nested loop to account for multi-part features (an array of arrays). So it would go Features -> Parts -> Vertices. – blah238 Oct 30 '11 at 1:11

The CreateFeatureClass_management has the necessary flags to enable Z values whereas CopyFeatures_management does not. Perhaps that is the necessary switch you need to make.

share|improve this answer

Let me say first that I spent few minutes learning what GIS is and few more minutes learning what arcpy is. In addition, I do not have required software to check your code. However, the similarity of your code and the code at Arc Gis Resource Center-Desktop10-polygon example-Create a polyline feature class from scratch is striking. What is missing in your code is the following.

"Add the first point of the array in to close off the polygon"


in between your lines


Did you try that already?

share|improve this answer

Are you using an existing feature class or are you creating the fc as part of this script? If it is part of the script can you post that portion as well? How are you setting the coordinate system, etc?

share|improve this answer
I don't have enough privilege to comment so please accept this "Answer" as a comment. It appears I am 8 points away! – theJones Oct 28 '11 at 17:11

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.