IDatasetContainer.addDS (dsFromFDLFIle) possible?

320
1
04-02-2014 03:18 PM
Ravichandran_M_Kaushika
Occasional Contributor
Using FME / Safe software an ESRI add in is able to get data from the servers - Arc Map 10.0 is not able to consume feature services from Arc Servers 10.2 or higher.  After getting esri's help we were able to add interop layer into arcmap.

the app is current exporting the features present in the wfs/interop layer to a file geodatabase.

the users want the app to export these features to a feature dataset inside the file geo database. (IExportOperation class)

I searched around and found that BrowseName and IDatasetcontainer are the 2 things that I need to work on.

to keep it simple, I have named the feature dataset to be spatial ref name as it will b unique for the file geodb.






any help will be greatly appreciated.

regards
ravi.
0 Kudos
1 Reply
Ravichandran_M_Kaushika
Occasional Contributor
CODE Works with problem:

�??
 �??
 IWorkspaceFactory pWorkSpaceFactory4ExpFunc;
IWorkspace pExportWorkspace;
IWorkspaceName pExportedDataWorkspaceName = newWorkspaceNameClass();
IDatasetName pExportTargetDSName;
  �??
             pWorkSpaceFactory4ExpFunc = (IWorkspaceFactory)CommonFunctions.ReturnFileGeoDBWorkspaceFactory();
             pExportWorkspace = CheckOrCreateFileGeoDBInInteropFolder(pWorkSpaceFactory4ExpFunc);
  �??
 IFeatureWorkspace ifwsFeatureWorkspace = (IFeatureWorkspace)pWorkSpaceFactory4ExpFunc.OpenFromFile(_strDataInteropFldrNameWOTrailingBackSlash + @"\ExportFDGB.gdb", 0);
IFeatureDataset ifsFeatDataSet4ExpHolder = null;
  �??
 IEnumDataset dslistInExpWS = pExportWorkspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
IDataset dsDatasetpresentinFileGeoDB = dslistInExpWS.Next();
while (dsDatasetpresentinFileGeoDB != null)
                 {
 if (dsDatasetpresentinFileGeoDB.Name == pSpatRefernce4FeatDS.Name)
                     {
                     ifsFeatDataSet4ExpHolder = (IFeatureDataset)dsDatasetpresentinFileGeoDB;
                     }
                 dsDatasetpresentinFileGeoDB = dslistInExpWS.Next();
                 }
  if (ifsFeatDataSet4ExpHolder == null)
                 {
                 ifsFeatDataSet4ExpHolder = ifwsFeatureWorkspace.CreateFeatureDataset(pSpatRefernce4FeatDS.Name,
                                                                                pSpatRefernce4FeatDS);
                  }
  IDatasetContainer idsContainer4ExportInFileGDB;
            idsContainer4ExportInFileGDB = (IDatasetContainer)ifsFeatDataSet4ExpHolder;
            pExportWorkspace = (IWorkspace)ifsFeatDataSet4ExpHolder.Workspace;
              pExportedDataWorkspaceName.PathName = pExportWorkspace.PathName;
  �??
             pExportedDataWorkspaceName.BrowseName = ifsFeatDataSet4ExpHolder.BrowseName.ToString();
              pExportTargetDSName = newFeatureClassNameClass();
            pExportTargetDSName.Name = "Exp" + _strLayerTblNameSelected.Replace(".fdl", ""); //name of the shapefile
            pExportTargetDSName.WorkspaceName = pExportedDataWorkspaceName;
  IEnumDataset iedsEnumDS2bDeleted = pExportWorkspace.get_Datasets(esriDatasetType.esriDTAny);





First point It breaks:
idsContainer4ExportInFileGDB.AddDataset(pDataSetFromFDL2FC);




2nd option I tried: it breaks again in the operation function:

IExportOperation pExportoperation;
            pExportoperation = newExportOperationClass();
  �??
 �??
             pExportoperation.ExportFeatureClass(pDatasetFromFDLFullName, null, null, null, (IFeatureClassName)pExportTargetDSName, 0);
//export layer - end

0 Kudos