The following example creates a new File geodatabase on your C drive, then converts a coverage feature dataset into feature dataset in the new File geodatabase. The "canada" coverage from the data folder of the developer's samples is converted.
To successfully run this script, you may need to modify the drive letter for the path to the input coverage data if it differs from where you installed the developer's samples.
How to use
- Modify the code to fit your data.
- Paste the code into your Application.
Public Sub ConvertToFGDB()
' create a new File Geodatabase to copy the feature dataset into. This new File
' Geodatabase will be called "canada.gdb" and will be located in "C:\data\". You can
' modify the script to change both the database name and its location.
Dim pPropset As IPropertySet
Dim pOutFileFact As IWorkspaceFactory
Dim pOutFileWorkspaceName As IWorkspaceName
Dim pOutFileFeatDSName As IFeatureDatasetName
Dim pOutFileDSName As IDatasetName
Dim pInCovWorkspaceName As IWorkspaceName
Dim pFeatureDatasetName As IFeatureDatasetName
Dim pCovDatasetName As IDatasetName
Dim pCovtoFD As IFeatureDataConverter
Set pOutFileFact = New FileGDBWorkspaceFactory
Set pOutFileWorkspaceName = pOutFileFact.Create("C:\data\", "canada", Nothing, 0)
' create a new feature datset name object for the output feature dataset, call
' it "Country"
Set pOutFileFeatDSName = New FeatureDatasetName
Set pOutFileDSName = pOutFileFeatDSName
Set pOutFileDSName.WorkspaceName = pOutFileWorkspaceName
pOutFileDSName.Name = "Country"
' now get the name object for the input coverage feature dataset name.
Set pInCovWorkspaceName = New WorkspaceName
pInCovWorkspaceName.PathName = "c:\data\"
pInCovWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesFile.ArcInfoWorkspaceFactory.1"
Set pFeatureDatasetName = New FeatureDatasetName
Set pCovDatasetName = pFeatureDatasetName
pCovDatasetName.Name = "canada"
Set pCovDatasetName.WorkspaceName = pInCovWorkspaceName
' now use the conversion function convert the coverage to an File feature dataset
Set pCovtoFD = New FeatureDataConverter
pCovtoFD.ConvertFeatureDataset pCovDatasetName, pOutFileDSName, Nothing, "", 1000, 0
MsgBox "Coverage conversion complete!"
End Sub