ArcObjects - 枚举地理数据库中的要素类和数据集
我正在尝试使用 vba/arcobjects 枚举文件地理数据库的内容(要素类和要素数据集,对表不感兴趣等)。
我将文件 GDB 设置为 IGxDatabase 对象,但找不到进一步深入的方法。我查看了地理数据库对象模型并尝试使用 IFeatureClass 和 IFeatureDataset,但似乎都没有返回有用的结果。
预先感谢您的任何帮助
I'm trying to enumerate the contents (feature classes and feature datasets, not interested in tables, etc) of a file geodatabase using vba/arcobjects.
I have the file GDB set as an IGxDatabase object, but can't find a way of getting further in. I've had a look at the geodatabase object model and tried using IFeatureClass and IFeatureDataset but neither seem to return useful results.
Thanks in advance for any assistance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
枚举地理数据库中包含的名称比枚举名称可以打开的内容要快得多。棘手的部分是循环遍历特征数据集中的名称。虽然 IFeatureWorkspace.Open 可用于打开要素类,而无需先打开包含它的要素数据集,但获取要素数据集中的要素类名称需要打开要素数据集。
如果您确定需要打开每个要素类,那么我想使用 IWorkspace.Datasets、IEnumDataset 和 IDataset 而不是 IWorkspaceDatasetNames、IEnumDatasetname 和 IDatasetname 不会有什么坏处。
It is much faster to enumerate the names contained in a geodatabase instead of the things that the names can open. The tricky part is looping through names in a featuredataset. While IFeatureWorkspace.Open can be used to open a featureclass without first opening the featuredataset that contains it, getting at featureclassnames within a featuredataset requires opening the featuredataset.
If you know for sure you'll need to open each featureclass, then I suppose it wouldn't hurt to use IWorkspace.Datasets, IEnumDataset, and IDataset instead of IWorkspaceDatasetNames, IEnumDatasetname and IDatasetname.
您可以在地理处理器上使用 ListFeatureClasses 方法
(下面展示了如何在 C# 中完成此操作)
you can use the ListFeatureClasses Method on the Geoprocessor
(the following shows how this can be done in C#)