Below is a snippet from a python class I created that accepts some esriJSON to create & manipulate some arcpy geometries and returns them as esriJSON. The last line is crashing ArcCatalog 10.1 (with the "Please tell ESRI about this problem" dialog). The "pou" is a fully-functioning arcpy.Polygon object (other than the JSON bit)--I can see its WKT, length, and area; and do other polygonal things with it like buffering & such. Does anyone out there have any experience with this sort of thing?
Thanks!
Dan
pou = tracedLine.buffer(bufferMeters)
fPoint = tracedLine.firstPoint
lPoint = tracedLine.lastPoint
bPod = arcpy.PointGeometry(fPoint,self.sr)
ePod= arcpy.PointGeometry(lPoint,self.sr)
self.OutputPodB = bPod.JSON
self.OutputPodE = ePod.JSON
self.OutputPou = pou.JSON ## This crashes Arc (even though all other arcpy.Geometry methods work fine on the pou object).
Solved! Go to Solution.
Well this is crude but it works. Thinking there might be something slightly corrupt about the pou polygon, I decided to try adding this code in place of the last line:
newPou = arcpy.Polygon(pou.getPart(0))
self.OutputPou = newPou.JSON
And that worked. I'm confident that the polygons I make will have but one part, but if you need to dump it into a for loop to get all parts you can do that too . . .
Well this is crude but it works. Thinking there might be something slightly corrupt about the pou polygon, I decided to try adding this code in place of the last line:
newPou = arcpy.Polygon(pou.getPart(0))
self.OutputPou = newPou.JSON
And that worked. I'm confident that the polygons I make will have but one part, but if you need to dump it into a for loop to get all parts you can do that too . . .