Select to view content in your preferred language

arcgis.geometry.union returns result without reference

296
1
Tuesday
Labels (1)
ZiqingYu1
New Contributor

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

ZiqingYu1_0-1756199234816.png

 

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:

ZiqingYu1_1-1756199413763.png

Anyone has an idea?

 

 

Tags (3)
0 Kudos
1 Reply
Clubdebambos
MVP Regular Contributor

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 

~ learn.finaldraftmapping.com
0 Kudos