AnsweredAssumed Answered

buffer() on a PointGeometry created from projectAs() returns a _passthrough object

Question asked by Jake.Adams@UtahAGRC on Oct 31, 2019
Latest reply on Nov 1, 2019 by rvburton

I'm trying to read in a CSV with point data in lat/long, reproject the points to UTM with .projectAs(), and then create a buffer around each point using .buffer(). I'm using the geometry objects rather than operating on feature classes as mentioned in the Discussion section of the PointGeometry documentation.


When I try this procedure and then insert the resulting geometry into a feature class using an insert cursor, it fails with SystemError: <built-in method insertRow of da.InsertCursor object at 0x000001BACC5F1B70> returned NULL without setting an error. Digging further reveals that the buffer() operation returns an arcpy.arcobjects.mixins.GeometrySpecializationMixin._passthrough object instead of an arcpy.arcobjects.geometries.Polygon object.


If I don't project a lat/long point but instead just buffer it directly, buffer() returns the Polygon object as expected (see example code below) and inserts just fine. If I create a very small buffer on the lat/long point (point.buffer(0.000001)), project the resulting polygon to UTM, and then buffer the UTM polygon it returns a Polygon as expected as well.


Am I using .projectAs() on the lat/long points wrong?


In [1]: import arcpy

In [2]: wgs84 = arcpy.SpatialReference(4326)

In [3]: utm = arcpy.SpatialReference(26912)

In [4]: p = arcpy.Point(10, 10)

In [5]: point = arcpy.PointGeometry(p, wgs84)

In [6]: type(point)
Out[6]: arcpy.arcobjects.geometries.PointGeometry

In [7]: utm_point = point.projectAs(utm)

In [8]: type(utm_point)
Out[8]: arcpy.arcobjects.geometries.PointGeometry

In [9]: point_buffer = point.buffer(10)

In [10]: type(point_buffer)
Out[10]: arcpy.arcobjects.geometries.Polygon

In [11]: utm_buffer = utm_point.buffer(10)

In [12]: type(utm_buffer)
Out[12]: arcpy.arcobjects.mixins.GeometrySpecializationMixin._passthrough