ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / LookupSymbol Method
Object id of the feature to lookup
The viewer whose scale or camera will be used
Example

In This Topic
    LookupSymbol Method
    In This Topic
    Looks up the symbol for the corresponding feature identified by the object id. This method will return null when the input OID is not part of the feature layer definition or if the renderer returns a null symbol. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public CIMSymbol LookupSymbol( 
       long oid,
       MapView view
    )
    Public Function LookupSymbol( _
       ByVal oid As Long, _
       ByVal view As MapView _
    ) As CIMSymbol

    Parameters

    oid
    Object id of the feature to lookup
    view
    The viewer whose scale or camera will be used

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    MapView is null
    Unsupported renderer type
    Remarks
    The looked up symbol takes into consideration the current view extent (2D) or camera distance from the ground (3D) and reference scale. Visual variables present on the renderer for color, size*, transparency, and rotation are applied.
    Not all renderers support symbol lookup. Check CanLookupSymbol to determine if the given feature layer renderer can support symbol lookup. Calling LookupSymbol on a layer with an unsupported renderer will throw a System.InvalidOperationException
    *Size visual variable with 3D views is currently assumed to be proportional on all symbol axis.
    Example
    Lookup Symbol
    //Note: Run within QueuedTask.Run
    //Get the selection
    var selection = featureLayer.GetSelection();
      //Get the first Object ID
      var firstOID = selection.GetObjectIDs().FirstOrDefault();
      //Determine whether the layer's renderer type supports symbol lookup.
      if (featureLayer.CanLookupSymbol())
      {
          //Looks up the symbol for the corresponding feature identified by the object id.
          var symbol = featureLayer.LookupSymbol(firstOID, MapView.Active);
          var jSon = symbol.ToJson(); //Create a JSON encoding of the symbol
          //Do something with symbol
      }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also