I am creating a series of geoprocessing tools for an AGE project and one of these tools includes a union function that is called when certain conditions are met. I am using the arcgis.geometry.module from the ArcGIS API for Python library. I am using a list comprehension of geometries that I created from a feature set that contains the polygons I would like to create a union from. I use this list comprehension as the geometries parameter in the union function to create a new polygon but what is returned is a single set of geometry, which appears to be the centroid of one of the polygons. Below is a summation of what my script looks like inside my union function.
Any help or insight into what I am doing wrong is greatly appreciated, thank you!
I tested your example and it works fine for me:
I'm on version 2.3.0.1 of the API. My guess is maybe your version isn't correctly parsing that JSON into geometry objects?
Any difference if you explicitly parse into Polygon objects beforehand?
from arcgis.geometry import Polygon
parsed = [
Polygon({'rings': [[
[-79608.7971409224, 853510.7087014914],
[-6525.311090338975, 856120.8334024921],
[-2610.1243669204414, 780427.2229789868],
[-78303.73479042202, 780427.2229789868],
[-79608.7971409224, 853510.7087014914]]],
'spatialReference': {'wkid': 2881, 'latestWkid': 2881}}),
Polygon({'rings': [[
[-44372.1163020879, 880917.0160934925],
[32626.556143827736, 886137.2648393214],
[41761.991941161454, 837849.9618078247],
[-44372.1163020879, 837849.9618078247],
[-44372.1163020879, 880917.0160934925]]],
'spatialReference': {'wkid': 2881, 'latestWkid': 2881}})]
Sorry for the late reply, but yes I have tried parsing into polygon objects as well. I have found a work around using dissolve but it is kind of clunky and would rather use union if possible. I am running 2.1.0.2