measurement.watch("viewModel.state", function (state) {console.log("Current state: ", state); if (state == "measured") {
//here i want to get the geometry off added graphics by active measurement tool.please help.}});
There is no documented way to get a reference to the geometry. However, if you're working in 2D (i.e. with a MapView), this presently works:
measurement.watch("viewModel.state", function (newValue, oldValue, propertyName, target) { if (newValue == "measured") { var geometry = target.viewModel.activeViewModel.tool._measurementLayer.graphics.getItemAt(0).geometry; } });
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.