Select to view content in your preferred language

Configure CoordinateConversion Widget to Show Only XY Format as Lat, Lon (ArcGIS JS API v4.32)

52
1
Thursday
alabanu
Emerging Contributor

Hi everyone,

I'm working on an Angular app using ArcGIS JavaScript API v4.32, and I need help customizing the CoordinateConversion widget.

I want to achieve two things:

  1. Keep only the "XY" format option (i.e., hide MGRS, UTM, etc.).

  2. Display it in Lat, Lon order (Latitude first, then Longitude)

I’ve tried this:

 const latLonFormat = new CoordinateFormat({
      name: "Lat Lon",
      currentPattern: "YX",
      defaultPattern: "YX"
    });
 const coordinateConversion = new CoordinateConversion({
      view: this.view,
      formats: [latLonFormat], 
      multipleConversions: false,
      visibleElements: {
        settingsButton: false,
        editButton: false,
        expandButton: true,
        captureButton: true
      }
    });

 

But the widget still displays Longitude, Latitude (i.e., X, Y), regardless of what I set in currentPattern.

0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

Hi @alabanu, thanks for posting your question here. You can do this, but you need to handle both the conversion and the reverse-conversion functions. Here is a sample app that you can follow:
https://codepen.io/noash/pen/EajrdrB?editors=1000

0 Kudos