打开DBF表->创建图层ESRI arcobjects
我已经成功打开了一个 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(layer)。所以我需要以某种方式将此对象从 featureWorkspace 转换为 ILayer。
看起来我可以只 CreateFeatureClass 然后转换为 ILayer,但是 CreateFeatureClass 有 6 个参数,包括 CLSID,所以我觉得我遗漏了一些概念点。感谢您的任何建议:)
//IFeatureClass featureclass = tableWorkspace.CreateFeatureClass //req six args, incl. CLSID
ILayer layer = featureclass as ILayer;
mapControl.AddLayer(layer);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,DBF 文件不用于查看,只有形状文件用于渲染,并且显然 DBF 以某种方式包含形状文件所需的数据。这是我被告知的,无论如何请随时启发我。
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.