HOW TO

Display coordinates in DMS in ArcGIS Pro pop-ups using Arcade

Last Published: June 20, 2023

Summary

In ArcGIS Pro, the coordinates of features can be displayed in pop-ups. While the Calculate Geometry Attributes tool can be used to add the location information to each feature, new fields are created to populate the values in the feature layer. If the coordinates are only used for display purposes and are not required to be stored in the feature layer, use the custom Arcade expression provided in this article to display the features' coordinates in degrees, minutes, and seconds (DMS) in the pop-ups.

Procedure

  1. In ArcGIS Pro, in the Contents pane, right-click the feature layer and select Configure Pop-ups.
  2. In the Configure Pop-ups pane, click Expressions.
  3. In the Expressions pane, click New.
  4. In Expression Builder, enter the custom Arcade expression below in the Expression box.
function MetersToLatLon(x, y) {
    var originShift = 2.0 * PI * 6378137.0 / 2.0;
    var longitude = (x / originShift) * 180.0;
    var latitude = (y / originShift) * 180.0;
    latitude = 180.0 / PI * (2.0 * Atan( Exp( latitude * PI / 180.0)) - PI / 2.0);
    return [latitude, longitude];
}

function convertToDms(dd, isLng) {
    var dir = "";
    if (dd < 0) {
        if (isLng) {
            dir = "E";
        } else {
            dir = "W";
        }
    } else {
        if (isLng) {
            dir = "S";
        } else {
            dir = "N";
        }
    }

    var absDd = Abs(dd);
    var deg = Floor(absDd, 0);
    var frac = absDd - deg;
    var min = Floor(frac * 60, 0);
    var sec = frac * 3600 - min * 60;
    
    sec = Round(sec * 100) / 100;
    return deg + "°" + min + "'" + sec + '"' + dir;
}

var latlon = MetersToLatLon(Geometry($feature).X, Geometry($feature).Y);

var latitude = convertToDms(latlon[0], False);
var longitude = convertToDms(latlon[1], False);

return longitude+" "+latitude;
  1. Click OK to add the expression.
  2. In the Expressions pane, click Back to return to the main Configure Pop-ups pane. The custom expression is automatically added to the fields displayed in the pop-ups.

The coordinates of the point feature are displayed in DMS in the pop-up.

A pop-up in ArcGIS Pro displaying the XY coordinate of a point feature.

Article ID: 000030704

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 9x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options