it is possible to formating 3 number behind point in measurement widget?

03-08-2021 11:11 PM
New Contributor II

Hallo, i want to question, i just use measurement widget, can i change the format point in distance, in below the value distance is 1.53 i want it to 1.534 (there is have 3 number behind point)

is possible? thank you



0 Kudos
2 Replies
MVP Notable Contributor

It has to be possible, though it's admittedly difficult to find it. Here on the Measurement Widget's docs, you can see in the example:


// After creating and adding the DistanceMeasurement2D widget
var measurementWidget = new DistanceMeasurement2D({
  view: view
view.ui.add(measurementWidget, "top-right");

// Raw measurements (in meters) can be accessed from this property"viewModel.measurement", function(measurement) {
    "Length: ", measurement.length,
    "Geometry: ", measurement.geometry



Unfortunately, you can also see in the measurementLabel section:

Lengths are rounded to two decimal places.


So it would seem that to get the raw measurement out and used in place of the label, you're going to have to do more than just change a setting, and get the measurement.length property (an unrounded number of meters) to replace the measurementLabel text somehow.

I'm admittedly out of my depth on the "how" part, but if you can get that raw length number pulled out, I'm sure the rest can't be too difficult. Best of luck!

- Josh Carlson
Kendall County GIS
0 Kudos
Esri Regular Contributor

Currently, I don't think this is possible with the Measurement widgets. If you want more levels of precision, I would recommend using something like the geometryEngine. Given the UI for the Measurement widgets, I don't know how much sense it makes to add more decimal places to the measurement.

That being said, it's certainly something we could consider if there is a good use-case. What benefit would adding a third (or more) decimal place to the Measurement widget confer that can't be better achieved with another option?

0 Kudos