Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In an arcpy script, I run a Union on a list of geometry objects. The output is set to an empty geometry object. The Union runs fine. What I am trying to do is then feed that output into the Dissolve tool. No matter how I format the input, I get the following error:

Parameters are not valid. ERROR 000732: Input Features: Dataset in_memory\f8537CACB_AB51_4BDC_B8E7_0895F11E6AF0 does not exist or is not supported

ESRI help files indicate that tools set to output to an empty geometry object return a list of geometry objects. The output from the Union tool gives <Geometry object at 0x26d25910[0x27397068]> when queried with repr(). I have tried putting the Union result directly into the Dissolve tool and likewise the 0 index item from the result, seeing as it supposed to be a list. Both result in an error, the latter saying that a geometry object is not indexable. Here is a code snippet:

if len(lstHSGeoms) > 1:
            #Union geometries into one geometry
            lstHSUnionGeom = arcpy.Geometry()
            arcpy.Union_analysis(lstHSGeoms, lstHSUnionGeom, "ONLY_FID")
            arcpy.AddMessage('          lstHSUnionGeom:  %s' % repr(lstHSUnionGeom))
            lstHSOneGeom = arcpy.Geometry()
            arcpy.Dissolve_management(lstHSUnionGeom,lstHSOneGeom, None, None, "SINGLE_PART")
            hsOneGeom = lstHSOneGeom[0]

The list lstHSGeoms is a Python list of polygon geometries, which have checked out as valid. The Union runs, but the Dissovle doesn't. I'm stymied. BTW, I tried using an empty string for the fourth parameter of Dissolve (seeing that it is supposed to be a string type), but it didn't make a difference.

share|improve this question
up vote 5 down vote accepted

Setting the output of a geoprocessing tool to an emtpy arcpy.geometry object is not the standard method for using in-memory workspaces. Instead, you want to set the output of the Union to a string variable that references the "file name" of the in-memory feature dataset, almost exactly as if you were using a shapefile. The only difference is that instead of setting your variable to C:\temp\lstHSUnionGeom.shp you would use in_memory\lstHSUnionGeom. Here's the updated code:

if len(lstHSGeoms) > 1:
            #Union geometries into one geometry
            lstHSUnionGeom = "in_memory\\lstHSUnionGeom" #Two slashes required due to escape character
            arcpy.Union_analysis(lstHSGeoms, lstHSUnionGeom, "ONLY_FID")
            arcpy.AddMessage('          lstHSUnionGeom:  %s' % repr(lstHSUnionGeom))
            lstHSOneGeom = "in_memory\\lstHSOneGeom" #Two slashes required due to escape character
            arcpy.Dissolve_management(lstHSUnionGeom,lstHSOneGeom, None, None, "SINGLE_PART")
share|improve this answer
Well, now, new tricks for an old dog. Thank you ever so kindly @dmahr. I shall keep this new knowledge in my hip pocket at the ready. In the present case, I tried your suggested code update, but it didn't work. I have tried several other variations that I could think of, but none of them have worked. I think the problem may be that I am working with geometries not features. I'm also working in 10.0, which may in itself be a problem. I simply want to be able to use geometry objects -- instead of features -- with geoprocessing tools ... like I'm supposed to be able to. Additional ideas? – celticflute Sep 11 '12 at 1:20
Sure thing! Now, when you say it didn't work, did it throw any errors? Did you try the exact same code, but writing the Union output to shapefiles to see if the issue is caused by something else? With ArcGIS and ArcPy as finnicky as they are, it's best to walk through the unknown parts of your code step-by-step to figure out where stuff is going wrong. – dmahr Sep 11 '12 at 1:26
Thanks again @dmahr. To answer your questions: (1) Yes, it did throw errors. It didn't like the setting of the in_memory path before using it as the output in the tool. It is just seen as a plain string, not a path name. Entering the in memory paths directly in the tool, seems to have worked or at least no errors were thrown; (2) No, I haven't output things to shapefiles, because I have only geometry objects, not features at this point. I very well may do this in the course of further troubleshooting. I now have a related question that I will post separately in just a bit. – celticflute Sep 11 '12 at 2:18
Find the above mentioned related question, now posted. – celticflute Sep 11 '12 at 3:03
I did try writing the Union output to a shapefile and found that the geometry was invalid. So, there is something wrong with the Union output after all. When I get the chance tomorrow I will try taking the geometries from the original Python list and putting them into a shapefile. Then I'll dissolve those and read the geometry of the Dissolve result. I don't want to have to do that, but if it works ... – celticflute Sep 11 '12 at 4:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.