# Problems constructing geometry using da.InsertCursor

Question asked by GSCUser85 on Jan 30, 2013
Latest reply on Feb 7, 2013 by GSCUser85
I have sucessfully used the old style InsertCursor to build lots of different geometries.
But today, I decided to have a look at the new da.InsertCursor and all those "SHAPE@" tokens.

Firstly, the geometry points are coming from a table in access.
Generally each polygon has 4 records. I read these into a python dictionary of the form -
[Key] : [(x1, y1), (x2, y2), (x3, y3), (x4, y4), (x1, y1)] ie my key is the polygon name and this points to a list of tuple pairs.
Note that I have repeated the first coord at the end so that the polygon closes.

So each of these code blocks is reading exactly the same data dictionary (PolyData).

Firstly, the old style way of doing it :

`OutCur = arcpy.InsertCursor(os.path.join(OutPath, OutPoly))  for k in PolyData:     v = PolyData[k]     array = arcpy.Array()     # print k, len(v)     for xy in v:         point = arcpy.Point()         point.X = xy         point.Y = xy         array.add(point)      FcPoly = OutCur.newRow()      FcPoly.setValue("PMLNo", k)     FcPoly.shape = array      OutCur.insertRow(FcPoly)          del OutCur`

Then the new da way:

`OutCur = arcpy.da.InsertCursor(os.path.join(OutPath, OutPoly + "2"), ["PMLNo", "SHAPE@"])  for k in PolyData:     v = PolyData[k]     array = arcpy.Array()     # print k, len(v)     for xy in v:         point = arcpy.Point()         point.X = xy         point.Y = xy         array.add(point)      polygon = arcpy.Polygon(array)     data = [k, polygon]     OutCur.insertRow(data)  del OutCur`

Sadly the da way gives me some decidely odd looking (and non-existant) geometries.
Have a look at the screen grab.
The red outlines are the output of the old way. The label in the middle is the polygon name.
The green outlines are the da way output. Not only has the geometry gone from a rhomboid to a triangle, but even the corners are in a different place(?).
A bigger worry is that most of this second polygon layer has null geometry. Note the lack of other green polygons, where the red ones are.

Can someone please advise me on what I am doing wrong with the da InsertCursor way of doing things.