Hi Users,
I am using measurement widget to get the area and the length, but I also need to have length of the polygon which cane be achieved through area and length parameters.
Any idea how to integrate it in measurement widget so that when I select the area tool and draw the polygon along with area it displays the perimeter as well.
Thanks
Aditya Kumar
Solved! Go to Solution.
Hi Aditya,
I have created sample for Custom Measurement widget as what you expect. I have attached the file and check it.
Let me know, If you have any queries.
Hi Aditya,
There is an option to get Area and Perimeter of polygon. You should create custom measurement widget.
I will give some tips,
Create draw toolbar like drawToolbar = new Draw(map);
On the "draw-end" event you get corresponding geometry. Then you check with geom type like,
if (geometry.type === "polygon") {
var areasAndLengthParams = new AreasAndLengthsParameters();
areasAndLengthParams.lengthUnit = GeometryService.UNIT_FOOT;
areasAndLengthParams.areaUnit = GeometryService.UNIT_ACRES;
areasAndLengthParams.calculationType = "geodesic";
geometryService.simplify([geometry], function(simplifiedGeometries) {
areasAndLengthParams.polygons = simplifiedGeometries;
geometryService.areasAndLengths(areasAndLengthParams);
});
}
For your reference, see this sample Geometry Service - Calculate geometry | ArcGIS API for JavaScript
Hi Kousik,
Thanks for the reply. Since i am a bit new to the technology I am facing issues to make a smooth flow.
Can you help me a bit more on this?
Thanks
Aditya Kumar
Hi Kousik,
Thanks a lot.This is what I was looking for.
Thanks