POST
|
Thanks for all the help guys. Installing Service Pack 3 fixed the problem.
... View more
12-07-2012
04:57 AM
|
0
|
0
|
321
|
POST
|
Thanks Neil for the suggestion. I'll give it a shot.
... View more
12-05-2012
12:10 PM
|
0
|
0
|
321
|
POST
|
Thanks for the reply and the help with posting protocol. I've tried this a thousand different ways, so sorry if I posted some obviously messy code. I was trying to use an IVariantArray in this situation as I used it to append shapefiles that were on my desktop successfully. However, I really believe the problem lies in the sde feature classes I'm utilizing not being .NET wrapped (just a generic System._ComObject). I know my sde connection is fine as I've used it for other matters. using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.DataManagementTools;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.DataSourcesGDB;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
namespace T
{
class Program
{
private static LicenseInitializer m_AOLicenseInitializer = new T.LicenseInitializer();
[STAThread()]
static void Main(string[] args)
{
//ESRI License Initializer generated code.
m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeArcInfo },
new esriLicenseExtensionCode[] { });
//ESRI License Initializer generated code.
//Do not make any call to ArcObjects after ShutDownApplication()
// Get geoprocessor
ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
gp.AddOutputsToMap = false;
// Get append tool
ESRI.ArcGIS.DataManagementTools.Append app = new ESRI.ArcGIS.DataManagementTools.Append();
IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("SERVER", "xxxxx");
propertySet.SetProperty("INSTANCE", "xxxxx");
propertySet.SetProperty("DATABASE", "xxxxx");
propertySet.SetProperty("USER", "xxxxx");
propertySet.SetProperty("PASSWORD", "xxxxx");
propertySet.SetProperty("VERSION", "xxxxx");
// Use activator
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
IWorkspace workspace = (IWorkspace)workspaceFactory.Open(propertySet, 0);
IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)workspace;
ESRI.ArcGIS.Geodatabase.IFeatureClass inputClass = (IFeatureClass)pFeatureWorkspace.OpenFeatureClass("sde.DBO.Tester2Updater");
ESRI.ArcGIS.Geodatabase.IFeatureClass targetClass = (IFeatureClass)pFeatureWorkspace.OpenFeatureClass("sde.DBO.Tester1Main");
//IVariantArray array = new VarArrayClass();
//array.Add(inputClass);
//array.Add(targetClass);
//array.Add("NO_TEST");
app.inputs = inputClass;
app.target = targetClass;
app.schema_type = "NO_TEST";
//This works for non-sde input (not worried about creating sde connection)
//IVariantArray array = new VarArrayClass();
//array.Add(@"D:\ProjectData\TestData2\test2.shp");
//array.Add(@"D:\ProjectData\TestData1\test1.shp");
//array.Add("NO_TEST");
//gp.Execute("Append_managament", array, null);
//gp.Execute("Append_management", array, null);
gp.Execute(app, null);
m_AOLicenseInitializer.ShutdownApplication();
}
}
}
... View more
12-05-2012
04:33 AM
|
0
|
0
|
321
|
POST
|
Had a typo in code displayed, but not the problem... ESRI.ArcGIS.Geodatabase.IFeatureClass targetClass = (IFeatureClass)pFeatureWorkspace.OpenFeatureClass("sde.DBO.Tester1Main");
... View more
12-04-2012
12:18 PM
|
0
|
0
|
321
|
POST
|
I'm trying to append two SDE feature classes together. I've been able to piece together the following code with no luck. My geoprocessor appears to be failing I believe because my feature classes are not wrapped in a strongly typed RCW, but I've not had any luck figuring out how to accomplish this (or I may be totally out in left field with what I'm trying to do). Any thoughts would be greatly appreciated. using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.DataManagementTools; using ESRI.ArcGIS.Geoprocessing; using ESRI.ArcGIS.Geoprocessor; using ESRI.ArcGIS.DataSourcesGDB; using ESRI.ArcGIS.Geodatabase; namespace T { class Program { private static LicenseInitializer m_AOLicenseInitializer = new T.LicenseInitializer(); [STAThread()] static void Main(string[] args) { //ESRI License Initializer generated code. m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeArcInfo }, new esriLicenseExtensionCode[] { }); //ESRI License Initializer generated code. //Do not make any call to ArcObjects after ShutDownApplication() // Get geoprocessor ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gp.AddOutputsToMap = false; // Get append tool ESRI.ArcGIS.DataManagementTools.Append app = new ESRI.ArcGIS.DataManagementTools.Append(); IPropertySet propertySet = new PropertySetClass(); propertySet.SetProperty("SERVER", "xxxxx"); propertySet.SetProperty("INSTANCE", "xxxxx"); propertySet.SetProperty("DATABASE", "xxxxx"); propertySet.SetProperty("USER", "xxxxx"); propertySet.SetProperty("PASSWORD", "xxxxx"); propertySet.SetProperty("VERSION", "xxxxx"); // Use activator Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory"); IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType); //workspaceFactory.Open(propertySet, 0); //IWorkspaceFactory workspaceFactory = new SdeWorkspaceFactoryClass(); IWorkspace workspace = (IWorkspace)workspaceFactory.Open(propertySet, 0); IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)workspace; //IFeatureWorkspace pFeatureWorkspace = workspaceFactory.Open(propertySet, 0) as IFeatureWorkspace; ESRI.ArcGIS.Geodatabase.IFeatureClass inputClass = (IFeatureClass)pFeatureWorkspace.OpenFeatureClass("sde.DBO.Tester2Updater"); ESRI.ArcGIS.Geodatabase.IFeatureClass targetClass = (IFeatureClass)pFeatureWorkspace.OpenFeatureClass("sde.DBO.Tester2Updater"); //MessageBox.Show(inputClass.ShapeType.ToString()); IVariantArray array = new VarArrayClass(); array.Add(inputClass); array.Add(targetClass); array.Add("NO_TEST"); //IVariantArray array = new VarArrayClass(); //array.Add(@"D:\ProjectData\TestData2\test2.shp"); //array.Add(@"D:\ProjectData\TestData1\test1.shp"); //array.Add("NO_TEST"); gp.Execute("Append_management", array, null); m_AOLicenseInitializer.ShutdownApplication(); } } }
... View more
12-04-2012
12:11 PM
|
0
|
7
|
2389
|
Online Status |
Offline
|
Date Last Visited |
03-09-2023
05:44 PM
|