Changing the default units of the measurement widget?

3130
3
10-29-2013 01:03 PM
IanPeebles
Occasional Contributor III
I have a measurement widget within my application.  When measuring, the default is set as Miles.  Can I change the default units to Feet?  Also, the default for measuring areas is set to Acres. . I need to default to Sq Feet.

Thanks.
0 Kudos
3 Replies
JoshVan_Kylen
New Contributor III

Set the defaultLengthUnit to esriFeet and the defaultAreaUnit to esriSquareFeet.

Example:

          measurement = new Measurement({

              map: map, defaultLengthUnit: "esriFeet", defaultAreaUnit: "esriSquareFeet"

          }, dom.byId('measurementDiv'));

          measurement.startup();

RickeyFight
MVP Regular Contributor

Ian,

Look here for more documentation:

Measurement | API Reference | ArcGIS API for JavaScript

0 Kudos
JoshVan_Kylen
New Contributor III

What I found unclear about this Measurement | API Reference | ArcGIS API for JavaScript documentation is that it references this Object: Units page, but when I used just "FEET" & "SQUARE_FEET" in the Measurement's parameters I get errors.  Hunting around I found the reference to set the parameter values to esriFeet & esriSquareFeet in the

Web AppBuilder's API reference for the Measurement widget.