public DisplayUnitFormat GetLocationUnitFormat()
Public Function GetLocationUnitFormat() As DisplayUnitFormat
public DisplayUnitFormat GetLocationUnitFormat()
Public Function GetLocationUnitFormat() As DisplayUnitFormat
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
//var map = MapView.Active.Map;
await QueuedTask.Run(() =>
{
//Get the current location unit
var loc_unit = map.GetLocationUnitFormat();
var line = $"{loc_unit.DisplayName}, {loc_unit.UnitCode}";
System.Diagnostics.Debug.WriteLine(line);
});
}
{
//Get the current view camera location
var center_pt = new Coordinate2D(mapView.Camera.X, mapView.Camera.Y);
//Get the current location unit
var loc_unit = await QueuedTask.Run(() => map.GetLocationUnitFormat());
//Format the camera location
var str = loc_unit.FormatLocation(center_pt, map.SpatialReference);
System.Diagnostics.Debug.WriteLine($"Formatted location: {str}");
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)