I am trying to get a memory geodatabase with custom name to work with Geo processing tools (executed in codebehind).
So, I have created a `MemoryConnectionProperties` object as follow
MemoryConnectionProperties _memoryConnectionProperties = new MemoryConnectionProperties("MyCustomName");
But yet I could not find out how to access it using `ExecuteToolAsync`?
Usually for memory I have used the following
var parameters = Geoprocessing.MakeValueArray("memory\\" + _targetFeatureClass.GetName(), shapeFileOutputDir, shapeFileOutputName);
var result = await Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass", parameters, null, null, null, GPExecuteToolFlags.None);
Which is fine with the default memory.
Since I would want to isolate several "tasks" the idea came up to use a custom memory name. But I could not find out how to define the memory location (with its custom name).
What I have tried without success
// does not work when executing "FeatureToFeatureClass" tool
var parameters = Geoprocessing.MakeValueArray("memory\\MyCustomName\\" + _targetFeatureClass.GetName(), shapeFileOutputDir, shapeFileOutputName);
// also does not work when executing "FeatureToFeatureClass" tool
var parameters = Geoprocessing.MakeValueArray("MyCustomName\\" + _targetFeatureClass.GetName(), shapeFileOutputDir, shapeFileOutputName);
Any ideas how to solve it?
Solved! Go to Solution.
Sorry, geoprocessing can only access the memory geodatabase called "memory."
--Rich
Sorry, geoprocessing can only access the memory geodatabase called "memory."
--Rich
Any intention to allow it to work custom named instances?
it is much easier to create a temp named instance than to manage create and destroy memory instances
While I don't work on the geoprocessing team, I have not heard of any plans.
There really shouldn't be any problem working with the default ("memory") memory geodatabase. If you're concerned about memory usage, you could always delete the tables that you have created when you are finished with them.
Creation is a bit tricky at the moment, because the code to do so is different depending on whether or not you have run a geoprocessing tool using "memory" already. Here's the workaround we shared at DevSummit:
Geodatabase geodatabase;
try {
geodatabase = new Geodatabase(new MemoryConnectionProperties());
}
catch {
geodatabase = SchemaBuilder.CreateGeodatabase(newMemoryConnectionProperties());
}
(We're fixing this at 3.1)