My current add-ons rely on shapefiles for working with temporary files. For example, if I run a spatial analyst tool, I create a new shapefile to store the output geometry. ArcGIS stores all temporary files in a default GDB. Can someone point me in the direction of some .NET code or resources that would help me to structure my temporary file handling in the same way? It would be nice to have everything in one GDB that could be cleared, rather than in a folder containing many shapefiles and rasters.
1 Answer 1
You might try using a scratch workspace or an inmemoryworkspace.
-
1Follow-up on this. I'd recommend trying InMemoryWorkspace first so you can avoid writing to disk. If that doesn't meet your needs (it doesn't support everything) then use FileGDBScratchWorkspaceFactory. There is really no need to use ScratchWorkspaceFactory anymore (it is based on a personal GDB and has all the limitations of personal GDBs with file size etc.)Craig Williams– Craig Williams2011年09月09日 17:51:14 +00:00Commented Sep 9, 2011 at 17:51
-
1@Craig Williams; actually its based on the fGDB not Personal or MDB file; and it is set to the default 4GB max-size. I found this to be problematic with large jobs where I needed to write out more than that; instead of the default of no-size-limit to keep expanding it would crash my process. This is by design of ESRI to keep a run-a-way process from eating all your disk and then crashing your machine. It really should be optional.D.E.Wright– D.E.Wright2011年09月09日 19:25:48 +00:00Commented Sep 9, 2011 at 19:25
-
Both of these are actually very useful for me (inmemory and GDBscratch). Thanks for the insight @Craig.Radar– Radar2011年09月09日 20:10:44 +00:00Commented Sep 9, 2011 at 20:10
-
@Craig I think inmemoryworkspaces will become even more useful when arcgis server is available for 64 bit. However, to truly leverage that, a new option is needed when creating an msd file: an option that lets you specify that a layer's featureclass should be cached into memory when the map service starts up. This should improve performance.Kirk Kuykendall– Kirk Kuykendall2011年09月09日 20:59:40 +00:00Commented Sep 9, 2011 at 20:59
-
@D.E.Wright ScratchWorkspaceFactory is based on Access. FileGDBScratchWorkspaceFactory is based on FileGDB. This is a very important distinction. InMemoryWorkspace is different from personal or FileGDB.Craig Williams– Craig Williams2011年09月09日 21:52:58 +00:00Commented Sep 9, 2011 at 21:52