我已成功打开DBF表:
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);
现在我要映射它,我认为需要调用mapControl.AddLayer(图层)。所以我需要以某种方式将此对象从featureWorkspace转换为ILayer。
看起来我可以只使用CreateFeatureClass然后转换为ILayer,但是CreateFeatureClass有6个参数,包括CLSID,所以我得到的印象是我缺少一些概念点。感谢您的任何建议:)
//IFeatureClass featureclass = tableWorkspace.CreateFeatureClass //req six args, incl. CLSID
ILayer layer = featureclass as ILayer;
mapControl.AddLayer(layer);
答案 0 :(得分:1)
显然DBF文件不是用于查看的,只有形状文件用于渲染,显然DBF包含shapefile所需的数据。这就是我被告知无论如何都可以随意启发我。