Доброго времени суток. Есть задача конвертировать шейп/GDB файлы в SDE с использованием asp.net. почему то при использовании инструментов аркгис FeatureClassToFeatureClass или FeatureClassToGeodatabase возникает ошибка и вылетает программа.
вот кусочек кода. может я что то не так ввожу
public static IWorkspace ArcSdeWorkspaceFromFile(String connectionFile)
{
Type factoryType = Type.GetTypeFromProgID(
"esriDataSourcesGDB.SdeWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)
Activator.CreateInstance(factoryType);
return workspaceFactory.OpenFromFile(connectionFile, 0);
}
private void button5_Click(object sender, EventArgs e)
{
FileInfo fi = new FileInfo(textBox1.Text);
string unpackDirectory = fi.DirectoryName;
IWorkspace workspace = ArcSdeWorkspaceFromFile(@"D:\test\test.sde");
Geoprocessor GP = new Geoprocessor();
FeatureClassToFeatureClass FF = new FeatureClassToFeatureClass();
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactoryClass();
//open the workspace containing the featureclass
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(unpackDirectory, 0);
//open the featureclass
IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(FileName.Text);
ITrackCancel trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass();
FF.in_features = featureClass;
FF.out_path = workspace.WorkspaceFactory;
FF.out_feature_class = "#";
FF.out_name = "Line";
FF.field_mapping = "#";
FF.where_clause = "#";
GP.OverwriteOutput = true;
try
{
IGeoProcessorResult result = GP.Execute(FF, trackCancel) as IGeoProcessorResult;
if (result != null)
{
if (result.Status != esriJobStatus.esriJobSucceeded)
Console.WriteLine("Failed to create the composite address Locator: ")
;
else
Console.WriteLine("Created the composite address Locator. ");
}
else
{
if (GP.MessageCount != 0)
{
for (int i = 0; i < GP.MessageCount; i++)
{
Console.WriteLine("GP Message " + i + " " + GP.GetMessage(i));
}
}
else
Console.WriteLine("Execution failed with no status. ");
}
}
catch (Exception W)
{
Console.WriteLine(
"An Exception occured while executing the CreateCompositeAddressLocator Tool: " + W);
}
}