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
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
measurementWidget.watch("viewModel.measurement", function(measurement) {
console.log(
"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!
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?
Hi @Noah-Sager , is there now a way to round the measurement to different decimal places?
Our users have also requested that they want to see the measurements rounded to full figures (without the decimals).
The use-case is they work with roads/streets so for measurements in units of metres/kilometres, they only need to see the measurement down to metres and not any more accurate that.
Hi @HenryKo2, this ability is not available yet. We have it in our roadmap, and I will update this post when we have something relevant to share.
Thanks @Noah-Sager . BTW, apart from the dialog, the label on the polyline drawn on the map also needs to be rounded the same way I suppose.
Hi @Noah-Sager ,
We have this requirement, to have 3 decimal places using the measure widget. Is this now possible? If not in web appbuilder then experience builder?
Thanks
Dave
Hi @davidchamberlain2, currently, this is not possible with OOTB Measurement widgets. If you want more levels of precision, I would recommend using something like the geometryEngine. However, we still have this in our roadmap, and I will update this post when we have something relevant to share.