AreasAndLengthsParameters and measurement widget

3212
4
Jump to solution
01-06-2016 05:16 AM
ADITYAKUMAR1
Occasional Contributor III

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

0 Kudos
1 Solution

Accepted Solutions
KousikM
New Contributor III

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.

View solution in original post

4 Replies
KousikM
New Contributor III

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

ADITYAKUMAR1
Occasional Contributor III

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

0 Kudos
KousikM
New Contributor III

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.

ADITYAKUMAR1
Occasional Contributor III

Hi Kousik,

Thanks a lot.This is what I was looking for.

Thanks

0 Kudos