Select to view content in your preferred language

Loading a table into memory from file gdb

179
1
Jump to solution
11-08-2024 05:11 AM
Gurunara
Frequent Contributor

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...

0 Kudos
1 Solution

Accepted Solutions
Gurunara
Frequent Contributor

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);





View solution in original post

0 Kudos
1 Reply
Gurunara
Frequent Contributor

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);





0 Kudos