Select to view content in your preferred language

Rounding distance and area measurement values into a single decimal place

130
0
09-30-2024 12:48 AM
LakshanRasingolla
Emerging Contributor

I have added DistanceMeasurement2D & AreaMeasurement2D tools to the ArcGIS map. I need to round the measurement value into a single decimal place (default two decimal places). Following is the relevant code snippet, 
Further, Are there any strategies to make measurements more accurate? 

      const distanceMeasurement2D = new DistanceMeasurement2D({
        viewModel: {
          view: view,
          unit: "kilometers",
        },
        container: distancemeasureContainerRef.current!,
      });

      const areaMeasurement2D = new AreaMeasurement2D({
        view: view,
        container: areameasureContainerRef.current!,
      });

      const clearMeasurement = () => {
        distanceMeasurement2D.viewModel.clear();
        areaMeasurement2D.viewModel.clear();
      };

      clearButton.current?.addEventListener("click", clearMeasurement);

 Following is the UI of the measurement, 
Screenshot 2024-09-30 131525.png

0 Kudos
0 Replies