Hi,
I need to union some Polygons into one using geometry.union, however, the result I got doesn't have a spatialReference, and I can't figure out why:
The Polygons are listed in a python list
And I tried both:
wkid = 32632
geo_union_2 = arcgis.geometry.union(shape_list, spatial_ref=wkid)
and
wkid = 32632
ref = arcgis.geometry.SpatialReference(wkid)
geo_union_1 = arcgis.geometry.union(shape_list, spatial_ref=ref)
I got the warning
ArcPy\arcpy\geoprocessing\_base.py:502: RuntimeWarning: No spatial reference detected, defaulting to unknown coordinate system.
return self._gp.FromEsriJson(json)
And the result remains:
Anyone has an idea?
Hi @ZiqingYu1,
I ran into similar a couple of weeks ago. Strangely this only occurred for me in a standalone script. When I used in a Notebook in ArcGIS Online, this issue was not present. For outside, I just update the spatial reference for the geometry returned from union.
unioned = union(geom_list)
## union return a list, access with index[0]
unioned[0]["spatialReference"] = {'wkid': 102100, "latestWkid" : 3857}
All the best,
Glen