Select to view content in your preferred language

Python Script Dissolve (in_)memory Error

431
4
02-07-2024 01:17 PM
TylerT
by
Frequent Contributor

Hello,

The following code produces an the following error:

 

 

 

fc_mem_1 = r"memory\temp_1"
...
fc_mem_2 = r"memory\temp_2" # memory fails, use in_memory
arcpy.analysis.PairwiseDissolve(fc_mem_1, fc_mem_2, 'cl_id', statistics_fields=stat_fields, multi_part='MULTI_PART')

 

 

 

TylerT_0-1707340078538.png

While the following code does not produce an error:

 

 

 

fc_mem_1 = r"memory\temp_1"
...
fc_mem_2 = r"in_memory\temp_2"
arcpy.analysis.PairwiseDissolve(fc_mem_1, fc_mem_2, 'cl_id', statistics_fields=stat_fields, multi_part='MULTI_PART')

 

 

 

I understand in_memory to be a legacy workspace.  Is this expected behavior with PairwiseDissolve and Dissolve?

Thank you,

Tyler

ArcGIS Pro 3.1.0

0 Kudos
4 Replies
MErikReedAugusta
Frequent Contributor

Somehow I missed the boat on "IN_MEMORY" becoming "MEMORY".  Do you have sources on that?  Because I clearly need to catch up on some reading.

0 Kudos
BlakeTerhune
MVP Regular Contributor
0 Kudos
KimOllivier
Honored Contributor

Yes, well the Pro developers forgot to read the ArcMap manuals.... there is now a synonym to patch up the syntax. I presume that it is a different mechanism under the hood. It never worked reliably for me anyway, so I just use an SSD drive as my scratch.gdb. You can easily run out of memory if you do not release the features, and who does that? Also projections did not work etc.

0 Kudos
KimOllivier
Honored Contributor

Save (in_)memory for simple tasks. It is a lot of people's experience that it does not always work for complex tasks like Dissolve. It did not work for me with geometry objects or reprojections.  If you have an SSD then define a partition or just a disk letter and use that for the scratch.gdb and other temporary featureclasses. Since it is effectively equivalent hardware you will get all the benefits of cached read/writes and more reliable operation with the same speed and not run out of memory.

0 Kudos