tags:

views:

11

answers:

1

I have successfully opened a DBF Table:

String dbfDirectoryPath = "Z:/ESRI/data/washingtonCountyDataFiles/tlg_roads";
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
IWorkspace workspace = workspaceFactory.OpenFromFile(dbfDirectoryPath, 0);
IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace;
String dbfTable = "tlg_roads_l.dbf"; 
ITable table = featureWorkspace.OpenTable(dbfTable);

Now I want to map it, which I think entails a call to mapControl.AddLayer(layer). So I need to convert this object from a featureWorkspace to a ILayer somehow.

It looks like I can just CreateFeatureClass and then cast to an ILayer, but there are 6 arguments for CreateFeatureClass including CLSID so I get the impression I am missing some conceptual points. Thanks for any advice : )

//IFeatureClass featureclass = tableWorkspace.CreateFeatureClass //req six args, incl. CLSID
ILayer layer = featureclass as ILayer;
mapControl.AddLayer(layer); 
A: 

Apparently DBF files are not for viewing and only shape files are for rendering and apparently somehow the DBF contains data necessary for the shapefiles. This is what I was told anyway feel free to enlighten me.

iterationx

related questions