Select to view content in your preferred language

Add Dataset or Topology from File Geodatabase to Map

806
1
Jump to solution
03-15-2019 03:07 AM
OscarDiago_Alonso
Occasional Contributor

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!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Oscar,

The topology API isn't complete within the Pro SDK at this time so the topology layer cant be created or added to the map.

View solution in original post

1 Reply
by Anonymous User
Not applicable

Oscar,

The topology API isn't complete within the Pro SDK at this time so the topology layer cant be created or added to the map.