1

I am not using ArcMap but I am creating a ArcGIS Desktop console app. I am pulling an external SQL table in as a querylayer. This table has lat & long so I created an eventlayer (or IXYEventSource xyEventSource). Now I want to export it to SDE as a featureclass but now I am stuck which route to take. Eventually, I want to put this exe in windows scheduler.

Any ideas on how to export to SDE?

1 Answer 1

1

An IXYEventSource is a FeatureClass, so you can treat it (i.e copy it) like any other FeatureClass.

There are so many ways of doing this, but one of the easier ones it to use the IFeatureDataConverter::ConvertFeatureClass method. The description is confusing (some people interpret it that it only works on Personal GDBs - but it works for Enterprise GDBs, too).

Update: Another option is the SimpleDataConverter here is an slightly modified extract from some other code I wrote awhile back.

  IFeatureClass m_pSourceDataset = myXYEventFC as IFeatureClass

  IFeatureClass pSourceFeatureClass = m_pSourceDataset as IFeatureClass;

  ISimpleDataConverter2 pDataConverter = new SimpleDataConverterClass();
  pDataConverter.InputDatasetName = m_pSourceDataset.FullName as IDatasetName;
  pDataConverter.InputQueryFilter = pInputQF;
  pDataConverter.OutputFeatureDatasetName = pOutputFD.FullName as IFeatureDatasetName;
  pDataConverter.OutputGeometryDef = pSourceFeatureClass.Fields.get_Field(pSourceFeatureClass.FindField(pSourceFeatureClass.ShapeFieldName)).GeometryDef;
  pDataConverter.OutputFields = pSourceFeatureClass.Fields;

  IEnumInvalidObject ipEnumInvalidObject = pDataConverter.Convert();

  // Get the unqualified name of input FC and use it to open output fc
  ISQLSyntax pSQLSyntax = pFWS as ISQLSyntax;
  String strOwnerName, strTableName, strDBName;
  pSQLSyntax.ParseTableName(m_pSourceDataset.Name, out strDBName, out strOwnerName, out strTableName);

  IFeatureClass pOutputFC = pFWS.OpenFeatureClass(strTableName) as IFeatureClass;
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.