0

In ArcGIS Desktop, it was very easy to:

-create a UID Class

-set a value

-enumerate through FocusMap layers, filtering by said UID Class value

This is what it looked like in ArcGIS for Desktop:

        UIDClass uIDClass = new UIDClass();
        uIDClass.Value = "{setValueHere}";  
        IEnumLayer layers = Document.FocusMap.get_Layers(uIDClass, true);

I have been searching through the Pro SDK for some sort of functional equivalent. For the life of me I can't figure out how to:

-find the UIDClass syntax to filter by, and then

-enumerate layers

I see a LOT about GetLayersAsFlattenedList(), but I can't figure out HOW to use it for my purpose.

1 Answer 1

0

In the FindLayer method documentation, you will see examples for all three layer search methods. You can search by layer

  • name
  • URI
  • a delegate/lambda function within a where() clause

I believe you will have to adapt your coding practices to search based URI rather than a UID. I don't recommend searching based on layer name since these can be duplicate within a Map.

To create a URI from a layer source, first use the .Net URI() instancing method, then feed that result to the FindLayer() method.

It may help your customization to carry around the overhead of a memory class with a dictionary of URIs and Layer Position in it along with a method you create like GetLayerByLayerPosition(). Such a function could first lookup the URI by layer position, then call the FindLayers() by that URI.

This way your customization could conveinantly access layers just by their order.

Caveat, you would have to listen to TOC changes to manage that object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.