AnsweredAssumed Answered

weird issue using geometry objects in python

Question asked by andrewhaley on Jan 20, 2014
Latest reply on Jan 21, 2015 by Dan_Patterson
Hi,

I am writing a script in python to generate polygons from lists of coordinates that I have saved in csv files.

I have followed the proper method of assigning the coordinates as point objects, adding them to an array, and then "arcpy.Polygon(array)" to get it as a polygon object.

I am having a weird issue when I try to make the polygon from the array.

I have gone into the shell and step by stepped it, when i print my array, i get this:

<Array [<Point (147.7359, -35.5386, #, #)>, <Point (147.7366, -35.539, #, #)>, <Point (147.737, -35.539, #, #)>, <Point (147.7375, -35.539, #, #)>, <Point (147.7374, -35.5397, #, #)>, <Point (147.7368, -35.5401, #, #)>, <Point (147.7354, -35.5403, #, #)>, <Point (147.7343, -35.5405, #, #)>, <Point (147.732, -35.5408, #, #)>, <Point (147.7304, -35.5409, #, #)>, <Point (147.7299, -35.5414, #, #)>, <Point (147.7287, -35.5422, #, #)>, <Point (147.7272, -35.5423, #, #)>, <Point (147.726, -35.5433, #, #)>, <Point (147.7255, -35.5439, #, #)>, <Point (147.7247, -35.5445, #, #)>, <Point (147.724, -35.5452, #, #)>, <Point (147.7228, -35.5432, #, #)>, <Point (147.7235, -35.5421, #, #)>, <Point (147.7249, -35.5416, #, #)>, <Point (147.7256, -35.5411, #, #)>, <Point (147.7269, -35.541, #, #)>, <Point (147.7275, -35.541, #, #)>, <Point (147.7283, -35.5409, #, #)>, <Point (147.7287, -35.5408, #, #)>, <Point (147.7296, -35.5399, #, #)>, <Point (147.7308, -35.5396, #, #)>, <Point (147.7323, -35.5395, #, #)>, <Point (147.7333, -35.5392, #, #)>, <Point (147.734, -35.5387, #, #)>, <Point (147.7347, -35.5386, #, #)>, <Point (147.7359, -35.5386, #, #)>]>


which looks good to me, they are the exact coordinates from my csv, same order, and i don't require Z or M values so the "#" marks are expected.

when I use Polygon.getPart(), i get this:
<Array [<Array [<Point (147.727905273, -35.5413818359, #, #)>, <Point (147.725097656, -35.5441894531, #, #)>, <Point (147.723327637, -35.5426025391, #, #)>, <Point (147.725280762, -35.5413208008, #, #)>, <Point (147.727905273, -35.5413818359, #, #)>]>]>


I have done this numerous times, and i am definitely using the correct array in the arcpy.Polygon() function...

I should note that the polygon i am trying to draw is quite a simple shape also... no "donut holes", and its not multi-part...

I have added an attachment comparing the two in arcmap.

has anyone ever come across this before?

Attachments

Outcomes