AnsweredAssumed Answered

Add Dataset or Topology from File Geodatabase to Map

Question asked by OsDiAl31 on Mar 15, 2019
Latest reply on Jun 11, 2019 by sean_jones-esristaff

Good morning!

 

Using the ArcGIS Pro SDK, I have added to my project a File GeoDatabase. I need to add all the contents of that FGDB (7 Feature Layers and 1 Topology) into the map.

 

No problem with the Feature Layers. I have found a way to add them one by one:

 

Dim gdbDefinitions As IReadOnlyList(Of FeatureClassDefinition) = TryCast(gdb.GetDatastore(), Geodatabase).GetDefinitions(Of FeatureClassDefinition)()
Dim definitionsList As List(Of FeatureClassDefinition) = gdbDefinitions.ToList()

Dim path As String = gdb.GetDatastore().GetPath().ToString()

For Each fcDef As FeatureClassDefinition In definitionsList
        Dim layerName As String = TryCast(fcDef, Definition).GetName()

        Dim pathLayer As String = path & "/TOPOLOGIA/" & layerName

        pathLayer = pathLayer.Replace("file:///", "")
        pathLayer = pathLayer.Replace("/", "\")

        Dim lyr As Layer = LayerFactory.Instance.CreateLayer(New Uri(pathLayer), map)

Next

That code only works for Feature Layers.

 

How can I add the Topology object into the map?

 

All of the objects are inside a Dataset, so another solution could be adding the Dataset into the map. But I haven't found any code snippet to achieve that, either.

 

Any help is welcomed! Thanks!

Outcomes