ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core.DeviceLocation Namespace / SerialPortDeviceLocationSource Class / GetSpatialReference Method
Example Version

GetSpatialReference Method (SerialPortDeviceLocationSource)
Returns the spatial coordinate system the coordinates will be emitted from a local device such as GPS/GNSS. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public override SpatialReference GetSpatialReference()

Return Value

Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run
Example
Get Current Device Location Source and Properties
bool isConnected = DeviceLocationService.Instance.IsDeviceConnected();

var src = DeviceLocationService.Instance.GetSource();

if (src is SerialPortDeviceLocationSource serialPortSrc)
{
  var port = serialPortSrc.ComPort;
  var antennaHeight = serialPortSrc.AntennaHeight;
  var dataBits = serialPortSrc.DataBits;
  var baudRate = serialPortSrc.BaudRate;
  var parity = serialPortSrc.Parity;
  var stopBits = serialPortSrc.StopBits;

  // retrieving spatial reference needs the MCT
  var sr = await QueuedTask.Run(() =>
  {
    return serialPortSrc.GetSpatialReference();
  });

}
var dlProps = DeviceLocationService.Instance.GetProperties();
var accuracy = dlProps.AccuracyThreshold;
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also