Code snippet for loading a table from file gdb into memory?
Tried several, but didn't seem to work:
MemoryConnectionProperties memoryConnectionProperties2 = new MemoryConnectionProperties();
Geodatabase memoryGdb = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties2);
var parameters = Geoprocessing.MakeValueArray(fileGdbPath + "\\" + outTabName, @"memory\\" + outTabName, "NO_TEST");
var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
var result = await Geoprocessing.ExecuteToolAsync("TableToInMemoryTable", parameters, environments, cancellationTokenSource?.Token, null, GPExecuteToolFlags.GPThread);
also tried:
var result = await Geoprocessing.ExecuteToolAsync("Copy_management", parameters, environments, cancellationTokenSource?.Token, null, GPExecuteToolFlags.GPThread);
and
var result = await Geoprocessing.ExecuteToolAsync("Append_management", parameters, environments, cancellationTokenSource?.Token, null, GPExecuteToolFlags.GPThread);
these all would result in result.IsFailed == true...
btw, this is for a table, not feature class...
Solved! Go to Solution.
First have to create the table:
MemoryConnectionProperties memoryConnectionProperties2 = new MemoryConnectionProperties();
var memoryGdb = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties2);
var parameters = Geoprocessing.MakeValueArray("memory", outTabName, fileGdbPath + "\\" + outTabName);
await Geoprocessing.ExecuteToolAsync("CreateTable_management", parameters);
parameters = Geoprocessing.MakeValueArray(fileGdbPath + "\\" + outTabName, "memory\\" + outTabName, "NO_TEST");
var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
var result = await Geoprocessing.ExecuteToolAsync("Append_management", parameters, environments, cancellationTokenSource?.Token, null, GPExecuteToolFlags.GPThread);
First have to create the table:
MemoryConnectionProperties memoryConnectionProperties2 = new MemoryConnectionProperties();
var memoryGdb = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties2);
var parameters = Geoprocessing.MakeValueArray("memory", outTabName, fileGdbPath + "\\" + outTabName);
await Geoprocessing.ExecuteToolAsync("CreateTable_management", parameters);
parameters = Geoprocessing.MakeValueArray(fileGdbPath + "\\" + outTabName, "memory\\" + outTabName, "NO_TEST");
var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
var result = await Geoprocessing.ExecuteToolAsync("Append_management", parameters, environments, cancellationTokenSource?.Token, null, GPExecuteToolFlags.GPThread);