ArcGIS Pro 3.7 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 Function GetCurrentSnapshot() As Snapshot
    public Snapshot GetCurrentSnapshot()
    Example
    Add the Most Recent Location To A Graphics Layer
    {
        //Note: Run within a QueuedTask
        // 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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also