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; //Must be on the 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);
var mv = MapView.Active; var map = mv.Map; QueuedTask.Run(() => { //Get the current view camera location var center_pt = new Coordinate2D(mv.Camera.X, mv.Camera.Y); //Get the current location unit var loc_unit = 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, Windows 10