I could not find any class or example for in memory workspace.
From the other hand there are many arcpy examples with in memory.
So (for example) if I run a GP tool from the SDK and let arcpy create a feature class in memory how do I access it from my code after it was created.
Here is a way you can get a path in python by creating temporary files rather then in memory. This would be only part of the puzzle, but perhaps this will help you figure out how to achieve what you want.
Here is an example on how I have used it to create and open an exported pdf.
# create temporary pdf name variable tmpdir = tempfile.mkdtemp() pfilename = tempfile.NamedTemporaryFile(prefix="Property_Map_") pdfname = pfilename.name + ".pdf" # Location of the tempoary pdf file outputpdf = os.path.join(tmpdir, pdfname) # export layout to a pdf layout.exportToPDF(outputpdf) # Open the excel file Popen("start acrobat %s" % (outputpdf), shell=True)
Instead of the full path to GDB (such as: "C:\myfolder\mygdb.gdb") just use "in_memory" or just "memory". Here is an example:
Syntax in Python:
outfc = r"in_memory\\out_fc"
Syntax in C# will be:
var outfc = "in_memory\\out_fc"
Alternatively, you can just use "memory\mydata".
We will add a snippet and sample to Geoprocessing SDK section: GitHub - Esri/arcgis-pro-sdk: ArcGIS Pro SDK for Microsoft .NET is the new .NET SDK for the ArcGIS P...
I'm using ArcPro 2.9.0 and am trying to use the "memory\mydata" format to join 2 layers in ModelBuilder. The documentation clearly states that I should not add a file extension. However, when I enter "memory\JoinParcelstoTable" to the Output Dataset box and click away ".shp" is automatically added to the end of my in memory folder path. When I try to run my model it fails on this tool. Any insights would be appreciated.
Just tested it.
Creating a feature class in memory with the GP command works.
new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"memory"))) fail with wrong Uri. What are we missing? Thanks
I have communicated with our Geodatabase team - they are following this thread. As of now, there is no API yet.
As of now, for Geoprocessing functionalities, we have "in_memory" and "memory" workspace - what it does is, the string is read as is but then internally interpret and convert it to a geodatabase which lives in memory.