1

I would like to dissolve a feature class by a field. When I run the code, I receive an error that says, "invalid topology [out of memory]" I have 16GB of RAM and terabytes available on the hard drive.

Here is my code:

#Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "Q:/LandTrendr_04/lt_ancillary/landtrendr_file_geodatabase/templates_testing/LandTrendr_GRPO_python.gdb/"

# Set local variables
inFeatures = "raster2polyg"
outFeatureClass = "polydissolve"
dissolveFields = ["UNIQUE"]

# Execute Dissolve using UNIQUE as Dissolve Fields
arcpy.Dissolve_management(inFeatures, outFeatureClass,dissolveFields,"","MULTI_PART", "DISSOLVE_LINES")

I would like to dissolve on the 'UNIQUE' field, no stats, create multipart polys, and dissolve lines.

I've tried to run this same tool through the toolbox and it works just fine. I would like to have this in a python script to help with my workflow.

Here is the output from the cmd prompt when I run the script. enter image description here

Thanks

-al

  • I don't think "DISSOLVE_LINES" is applicable to Polygon features, only Polyline features. – klewis Feb 20 '14 at 20:57
2

Memory errors can very often be resolved using 64-bit background geoprocessing. This is not necessarily installed by default, especially if you are running ArcGIS through a larger organization such as a University. You will need to check to see if the following exists on your system:

C:\Python27\ArcGISx6410.2

Also, when defining the workspace with the arcpy.env.workspace method, you need to make sure the path does not end with a "/". Otherwise, when Python appends your filename to your workspace path in the dissolve function, the result would be (incorrectly) the following:

"Q:/LandTrendr_04/.../LandTrendr_GRPO_python.gdb//polydissolve"

Therefore, replace:

env.workspace = "Q:/LandTrendr_04/.../LandTrendr_GRPO_python.gdb/"

with:

env.workspace = "Q:/LandTrendr_04/.../LandTrendr_GRPO_python.gdb"
  • Thanks Aaron. I fixed the error, however I still receive the same error. "arcgisscripting.ExecuteError: ERROR 999999: Error executing function. Invalid Topology [Out of memory.] Failed to execute (Dissolve). – Al K Feb 20 '14 at 19:58
  • Try running the script again, this time using "SINGLE_PART". – Aaron Feb 20 '14 at 20:01
  • 2
    If you're running ArcGIS 10.1 or 10.2, consider running this as a 64-bit background process. More info here: resources.arcgis.com/en/help/main/10.2/index.html#//… – Aaron Feb 20 '14 at 20:30
  • 1
    @AlK If you think you may be running out of memory then you can watch the process using Task Manager to see if its memory usage is continuing to build prior to the error. As a test you could also try Select-ing half your features into a test dataset to see if being able to Dissolve that without a problem suggests that your feature class is just too big for your amount of memory. In the latter case I think you should submit your dataset to your local Esri support. Trying 64bit background geoprocessing is a good idea but that has not played nicely with large models for me. – PolyGeo Feb 20 '14 at 22:21
  • 1
    The solution to this problem for me was to install and run 64 geoprocessing which also installs 64bit python. I then called the 64bit python directly from the command line when I ran my script. To see how to run as 64bit process, follow @Aaron's link. Thanks Aaron! PolyGeo was able to lead me to the problem by having me try to run the process with a smaller dataset. Thanks PolyGeo! – Al K Feb 25 '14 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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