Converting a Coverage to an Access GeoDatabase

Description:

The following example creates a new Access database on your D drive, then converts a coverage feature dataset into feature dataset in the new Access database. The "canada" coverage from the data folder of the developer's samples is converted.



NOTE: 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:
  1. Modify the code to fit your data.
  2. Paste the code into your VBA Application.
Sub CovertoAccess()
 ' create a new Access database to copy the feature dataset into. This new access
 ' database  will be called "canada.mdb" and will be located in "D:\data\canada". You can
 ' modify the script to change both the database name and its location.
  Dim pPropset As IPropertySet
  Dim pOutAcFact As IWorkspaceFactory
  Dim pOutAcWorkspaceName as IWorkspaceName
  Dim pOutAcFeatDSName As IFeatureDatasetName
  Dim pOutAcDSName As IDatasetName
  Dim pInCovWorkspaceName As IWorkspaceName
  Dim pFeatureDatasetName As IFeatureDatasetName
  Dim pCovDatasetName As IDatasetName
  Dim pCovtoFD As IFeatureDataConverter

  Set pPropset = New PropertySet
  pPropset.SetProperty "Database", "D:\data\canada"

  Set pOutAcFact = New AccessWorkspaceFactory
  Set pOutAcWorkspaceName = pOutAcFact.Create("D:\data\canada", "canada", pPropset, 0)
      
  ' create a new feature datset name object for the output Access feature dataset, call
  ' it "Country"
  Set pOutAcFeatDSName = New FeatureDatasetName
  Set pOutAcDSName = pOutAcFeatDSName
  Set pOutAcDSName.WorkspaceName = pOutAcWorkspaceName
  pOutAcDSName.name = "Country"
   
  ' now get the name object for the input coverage feature dataset name.
  Set pInCovWorkspaceName = New WorkspaceName
  pInCovWorkspaceName.pathname = "D:\data\canada"
  pInCovWorkspaceName.WorkspaceFactoryProgID = "esriCore.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 Access feature dataset
  Set pCovtoFD = New FeatureDataConverter
  pCovtoFD.ConvertFeatureDataset pCovDatasetName, pOutAcDSName, Nothing, "", 1000, 0
  
  MsgBox "Coverage conversion complete!"
End Sub