[Tips] How to converting a Coverage to a Shapefile ?
converts a coverage feature class (region) into a new shapefile with the proper feature type. The "canada " coverage from the data folder of the developer's samples is converted.
Sub CovertoShape()
' use IFeatureDataConverter::Convertfeatureclass to go from
' a coverage to shapefile
' Setup the output dataset
Dim pPropset As IPropertySet
Dim pOUTshwsname As IWorkspaceName
Dim pOutShFCName As IFeatureClassName
Dim pOutshDSName As IDatasetName
Dim pInCovWorkspaceName As IWorkspaceName
Dim pInFCName As IFeatureClassName
Dim pCovDatasetName As IDatasetName
Dim pCovtoshape As IFeatureDataConverter
Set pPropset = New PropertySet
pPropset.SetProperty "DATABASE", "D:\data\canada"
Set pOUTshwsname = New WorkspaceName
pOUTshwsname.ConnectionProperties = pPropset
pOUTshwsname.WorkspaceFactoryProgID = "esriCore.shapefileWorkspaceFactory.1"
' create a new feature datset name object for the output
' canshape is a new shapefile polyline
Set pOutShFCName = New FeatureClassName
Set pOutshDSName = pOutShFCName
Set pOutshDSName.WorkspaceName = pOUTshwsname
pOutshDSName.name = "canshape"
' 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 pInFCName = New FeatureClassName
Set pCovDatasetName = pInFCName
pCovDatasetName.name = "canada:region.prov"
Set pCovDatasetName.WorkspaceName = pInCovWorkspaceName
' now use the conversion function convert the coverage to an Access feature dataset
Set pCovtoshape = New FeatureDataConverter
pCovtoshape.ConvertFeatureClass pInFCName, Nothing, Nothing, pOutShFCName, Nothing, Nothing, "", 1000, 0
MsgBox "Coverage conversion complete!"
End Sub
' use IFeatureDataConverter::Convertfeatureclass to go from
' a coverage to shapefile
' Setup the output dataset
Dim pPropset As IPropertySet
Dim pOUTshwsname As IWorkspaceName
Dim pOutShFCName As IFeatureClassName
Dim pOutshDSName As IDatasetName
Dim pInCovWorkspaceName As IWorkspaceName
Dim pInFCName As IFeatureClassName
Dim pCovDatasetName As IDatasetName
Dim pCovtoshape As IFeatureDataConverter
Set pPropset = New PropertySet
pPropset.SetProperty "DATABASE", "D:\data\canada"
Set pOUTshwsname = New WorkspaceName
pOUTshwsname.ConnectionProperties = pPropset
pOUTshwsname.WorkspaceFactoryProgID = "esriCore.shapefileWorkspaceFactory.1"
' create a new feature datset name object for the output
' canshape is a new shapefile polyline
Set pOutShFCName = New FeatureClassName
Set pOutshDSName = pOutShFCName
Set pOutshDSName.WorkspaceName = pOUTshwsname
pOutshDSName.name = "canshape"
' 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 pInFCName = New FeatureClassName
Set pCovDatasetName = pInFCName
pCovDatasetName.name = "canada:region.prov"
Set pCovDatasetName.WorkspaceName = pInCovWorkspaceName
' now use the conversion function convert the coverage to an Access feature dataset
Set pCovtoshape = New FeatureDataConverter
pCovtoshape.ConvertFeatureClass pInFCName, Nothing, Nothing, pOutShFCName, Nothing, Nothing, "", 1000, 0
MsgBox "Coverage conversion complete!"
End Sub