Remove some units from the dropdowns of the measurement widget

734
3
Jump to solution
12-14-2016 07:54 AM
Labels (1)
GilbertoMatos
Occasional Contributor II

Hello!

I need to remove some units from the dropdowns of the measurement widget, but I could not find where the fields are populated.

I need to do some things like:

- Remove the "DMS" option from the point feature;

- Leave to the measurement functionality (line) only kilometers and meters;

- Leave to the measurement feature (polygon) only the units of square kilometers, square meters and hectares.

Any idea how to do this?
Any help is welcome.

Thank you!
Gilberto.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Gilberto,

   In the Widget.js make these changes (lines 12 - 17):

        this._processConfig(json).then(lang.hitch(this, function(measurementJson) {
          this.measurement = new Measurement(measurementJson, this.measurementDiv);
          this.own(aspect.after(this.measurement, 'setTool', lang.hitch(this, function() {
            if (this.measurement.activeTool) {
              this.disableWebMapPopup();
            } else {
              this.enableWebMapPopup();
            }
          })));

          this.measurement.startup();
          this.measurement._distanceUnitStrings = ["Kilometers", "Meters"];
          this.measurement._distanceUnitStringsLong = ["esriKilometers", "esriMeters"];
          this.measurement._areaUnitStrings = ["Sq Kilometers", "Sq Meters", "Hectares"];
          this.measurement._areaUnitStringsLong = ["esriSquareKilometers", "esriSquareMeters", "esriHectares"];
          this.measurement._locationUnitStrings = ["Degrees"];
          this.measurement._locationUnitStringsLong = ["esriDecimalDegrees"];
          ....

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Gilberto,

   In the Widget.js make these changes (lines 12 - 17):

        this._processConfig(json).then(lang.hitch(this, function(measurementJson) {
          this.measurement = new Measurement(measurementJson, this.measurementDiv);
          this.own(aspect.after(this.measurement, 'setTool', lang.hitch(this, function() {
            if (this.measurement.activeTool) {
              this.disableWebMapPopup();
            } else {
              this.enableWebMapPopup();
            }
          })));

          this.measurement.startup();
          this.measurement._distanceUnitStrings = ["Kilometers", "Meters"];
          this.measurement._distanceUnitStringsLong = ["esriKilometers", "esriMeters"];
          this.measurement._areaUnitStrings = ["Sq Kilometers", "Sq Meters", "Hectares"];
          this.measurement._areaUnitStringsLong = ["esriSquareKilometers", "esriSquareMeters", "esriHectares"];
          this.measurement._locationUnitStrings = ["Degrees"];
          this.measurement._locationUnitStringsLong = ["esriDecimalDegrees"];
          ....
GilbertoMatos
Occasional Contributor II

Hi Robert!

It worked. However, the options that open for selection are appearing in English. Only after the selection, they move to Portuguese. Is there a way to force the use of nls (pt-br) in this code snippet?

Thank you!
Gilberto.

0 Kudos
GilbertoMatos
Occasional Contributor II

Robert, thank you for your help.

I was able to do nls search.

Thank you very much.
I'm marking the correct answer.

Hug,
Gilberto.

0 Kudos