FormatLocation(Coordinate2D,SpatialReference) Method
Format the input location using the location unit format. This method
must be called on the MCT. Use QueuedTask.Run.
Parameters
- location
- sr
Return Value
A formatted location string
Format a Location Using the Current Map Location Unit
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
ArcGIS Pro version: 3 or higher.