MappingDeviceLocationNavigationMode Enumeration
Specifies how the current map view is repositioned using the
open device source location (i.e via GPS/GNSS).
Get Current Map Device Location Options
var options = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
var visibility = options.DeviceLocationVisibility;
var navMode = options.NavigationMode;
var trackUp = options.TrackUpNavigation;
var showBuffer = options.ShowAccuracyBuffer;
Set Current Map Device Location Options
//Must be on the QueuedTask.Run()
//Check there is a source first...
if (DeviceLocationService.Instance.GetSource() == null)
//Setting DeviceLocationOptions w/ no Device Location Source
//Will throw an InvalidOperationException
return;
var map = MapView.Active.Map;
if (!MapDeviceLocationService.Instance.IsDeviceLocationEnabled)
//Setting DeviceLocationOptions w/ no Device Location Enabled
//Will throw an InvalidOperationException
return;
MapDeviceLocationService.Instance.SetDeviceLocationOptions(
new MapDeviceLocationOptions()
{
DeviceLocationVisibility = true,
NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter,
TrackUpNavigation = true
});
Set map view to always be centered on the device location
var currentOptions = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
if (currentOptions == null)
return;
currentOptions.DeviceLocationVisibility = true;
currentOptions.NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter;
await QueuedTask.Run(() =>
{
MapDeviceLocationService.Instance.SetDeviceLocationOptions(currentOptions);
});
System.Object
System.ValueType
System.Enum
ArcGIS.Desktop.Mapping.DeviceLocation.MappingDeviceLocationNavigationMode
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3.0 or higher.