5

I have been using in-memory workspace for creating temporary features, but I was wondering if we could create a temporary in-memory geodatabase (using ArcPy) and then use it for importing other in-memory features?

0

2 Answers 2

10

As @PolyGeo said, you won't be able to use the in_memory workspace for Geodatabases.

If you want a "temporary" geodatabase that is saved on disk, you can use the Scratch GDB.

#Set the path to GDB, if desired. 
#Consult help if you don't want to set this and want to know its location.
arcpy.env.scratchWorkspace = r"D:\GIS\data"

#Path to newly created gdb.
gdb = arcpy.env.scratchGDB

print gdb
>>> "D:\GIS\data\scratch.gdb"
0
8

An in_memory workspace is one of the three broad categories of workspace available to you - the others are folder and geodatabase.

However, you can think of the in_memory workspace being already analogous in structure to a file geodatabase held in memory, but there are limitations that are mostly documented.

What you are describing sounds like it is outside the design of in_memory workspaces.

I frequently write/read/process feature classes to/from/in in_memory workspaces using ArcPy but when I want to make them available in a file (or any other type of) geodatabase I copy them to disk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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