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.
Solved! Go to Solution.
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"];
....
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"];
....
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.
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.