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 <SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">import</SPAN> arcpy
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> wgs84 <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SpatialReference<SPAN class="punctuation token">(</SPAN><SPAN class="number token">4326</SPAN><SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">3</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> utm <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SpatialReference<SPAN class="punctuation token">(</SPAN><SPAN class="number token">26912</SPAN><SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> p <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Point<SPAN class="punctuation token">(</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">10</SPAN><SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> point <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>PointGeometry<SPAN class="punctuation token">(</SPAN>p<SPAN class="punctuation token">,</SPAN> wgs84<SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">6</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> type<SPAN class="punctuation token">(</SPAN>point<SPAN class="punctuation token">)</SPAN>
Out<SPAN class="punctuation token">[</SPAN><SPAN class="number token">6</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>arcobjects<SPAN class="punctuation token">.</SPAN>geometries<SPAN class="punctuation token">.</SPAN>PointGeometry
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">7</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> utm_point <SPAN class="operator token">=</SPAN> point<SPAN class="punctuation token">.</SPAN>projectAs<SPAN class="punctuation token">(</SPAN>utm<SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">8</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> type<SPAN class="punctuation token">(</SPAN>utm_point<SPAN class="punctuation token">)</SPAN>
Out<SPAN class="punctuation token">[</SPAN><SPAN class="number token">8</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>arcobjects<SPAN class="punctuation token">.</SPAN>geometries<SPAN class="punctuation token">.</SPAN>PointGeometry
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">9</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> point_buffer <SPAN class="operator token">=</SPAN> point<SPAN class="punctuation token">.</SPAN>buffer<SPAN class="punctuation token">(</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> type<SPAN class="punctuation token">(</SPAN>point_buffer<SPAN class="punctuation token">)</SPAN>
Out<SPAN class="punctuation token">[</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>arcobjects<SPAN class="punctuation token">.</SPAN>geometries<SPAN class="punctuation token">.</SPAN>Polygon
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">11</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> utm_buffer <SPAN class="operator token">=</SPAN> utm_point<SPAN class="punctuation token">.</SPAN>buffer<SPAN class="punctuation token">(</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">)</SPAN>
In <SPAN class="punctuation token">[</SPAN><SPAN class="number token">12</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> type<SPAN class="punctuation token">(</SPAN>utm_buffer<SPAN class="punctuation token">)</SPAN>
Out<SPAN class="punctuation token">[</SPAN><SPAN class="number token">12</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>arcobjects<SPAN class="punctuation token">.</SPAN>mixins<SPAN class="punctuation token">.</SPAN>GeometrySpecializationMixin<SPAN class="punctuation token">.</SPAN>_passthrough<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>