ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Core.DeviceLocation Namespace / DeviceLocationService Class / GetCurrentSnapshot Method
Example

In This Topic
    GetCurrentSnapshot Method (DeviceLocationService)
    In This Topic
    Returns the most recent snapshot received from the open device location source.
    Syntax
    public Snapshot GetCurrentSnapshot()
    Public Function GetCurrentSnapshot() As Snapshot
    Example
    Add the Most Recent Location To A Graphics Layer
    //var graphicsLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    // get the last location
    var pt = DeviceLocationService.Instance.GetCurrentSnapshot()?.GetPositionAsMapPoint();
    if (pt != null)
    {
      //Create a point symbol
      var ptSymbol = SymbolFactory.Instance.ConstructPointSymbol(
                        CIMColor.CreateRGBColor(125, 125, 0), 10, SimpleMarkerStyle.Triangle);
      //Add a graphic to the graphics layer
      graphicsLayer.AddElement(pt, ptSymbol);
      //unselect it
      graphicsLayer.ClearSelection();
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also