CoordinateConversion change formats name

567
5
12-07-2021 02:21 AM
RemiBecheru
New Contributor II

RemiBecheru_0-1638872046858.png

How to change the name of those formats.

If I try to reassign format.name = 'new name' it works but the coordinates disappear as below pic.

RemiBecheru_1-1638872462908.png

 

 

5 Replies
Noah-Sager
Esri Regular Contributor

Hi @RemiBecheru, thanks for the question. Unfortunately, this is not currently possible. The only alternative would be duplicating one of the existing formats, but giving it a different name. But then you would have to implement the conversion logic yourself.

We are considering this as an enhancement for the CoordinateConversion widget. Could you explain why this functionality would be useful for your work/project?

0 Kudos
RemiBecheru
New Contributor II

Considering in production the app will be used by people which don't know what DD means for example.

That's why it will be more explanatory to change DD.name with Lat. Long.

0 Kudos
Noah-Sager
Esri Regular Contributor

Thanks @RemiBecheru, that makes sense. We'll add this enhancement to our roadmap. I'm not sure when this will be come available, but I made a note to update this thread when I have some news to share. 

Flookfinders
New Contributor II

I have noticed in the 4.24 release there is a new property label, is it possible to now achieve this using this new property and if so, how?

0 Kudos
Flookfinders
New Contributor II

After some playing around I have managed to change the label using the following code:

reactiveUtils
  .whenOnce(() => ccWidget.formats.length > 0)
  .then(() => {
    let filteredFormats =
      ccWidget.formats.items.filter(
        (f) => f.name === "basemap" || f.name === "xy"
      );
    filteredFormats[
      filteredFormats.findIndex((f) => f.name === "basemap")
    ].label = "BNG";
    filteredFormats[
      filteredFormats.findIndex((f) => f.name === "xy")
    ].label = "Long/Lat";
    ccWidget.formats.items = filteredFormats;
  });
0 Kudos