ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping.DeviceLocation Namespace / IMapDeviceLocationService Interface / GetDeviceLocationOptions Method
Example

In This Topic
    GetDeviceLocationOptions Method (IMapDeviceLocationService)
    In This Topic
    Gets the MapDeviceLocationOptions currently used by the MapDeviceLocationService.
    Syntax
    MapDeviceLocationOptions GetDeviceLocationOptions()
    Function GetDeviceLocationOptions() As MapDeviceLocationOptions

    Return Value

    Example
    Get Current Map Device Location Options
    {
      //Gets the current device location options used by the MapDeviceLocationService
      var options = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
      //Device location visibility on the map
      var visibility = options.DeviceLocationVisibility;
      //MappingDeviceLocationNavigationMode
      var navMode = options.NavigationMode;
      //Heading of the location from the device points to the top of the screen
      var trackUp = options.TrackUpNavigation;
      //Show accuracy buffer on the map
      var showBuffer = options.ShowAccuracyBuffer;
    }
    Set map view to always be centered on the device location
    {
      // Get the MapDeviceLocationOptions currently used by the MapDeviceLocationService
    
      var currentOptions = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
      if (currentOptions == null)
      {
        return;
      }
      // Set the device location visibility on the map to true
      currentOptions.DeviceLocationVisibility = true;
      //Set the navigation mode to keep the device location at the center of the map
      currentOptions.NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter;
      //Sets the MapDeviceLocationOptions to be updates with these values
      await QueuedTask.Run(() =>
        MapDeviceLocationService.Instance.SetDeviceLocationOptions(currentOptions));
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also