Is it possible to change the default unit of the location tool on the measurement widget?
I would like to default to DMS instead of Degrees.
Area and length both have properties to set the default unit (defaultAreaUnit, defaultLengthUnit)...why not Location???
Also, is it possible to limit the units of measure that I do not want to be in the drop down list? I don't want the user to be able to choose Degrees at all.
Yes, it is possible....although undocumented. I'm not sure what the big secret is, or if it was simply an oversight.
If you look at the Measurement Widget sample (Measurement Widget | ArcGIS API for JavaScript)
and play in the sandbox, you can change the defaultLengthUnit, defaultAreaUnit, and the _defaultLocationUnit .
Notice the preceding underscore for the _defaultLocationUnit. Not sure why that one is left out of the documentation...
var measurement = new Measurement({
map: map,
defaultLengthUnit: "esriMiles",
defaultAreaUnit: "esriSquareFeet",
_defaultLocationUnit: "esriDegreeMinuteSeconds",
}, dom.byId("measurementDiv"));
I would still like to know how to remove unwanted units from the dropdown lists in the Measurement Widget.
Hey slcemcphee33, did you ever find a way to remove the unwanted units from the dropdown list?
The only solution I found was to download a copy of the API locally and remove the entries from the actual API backend. Would love a more elegant solution
I had come to the same conclusion...would need to download the API locally. I did not go this route. I still have Nautical Miles in my Measurement widget for no good reason
Yeah no bueno. Having the same issue.
While I have you here though, I'm trying to what I think is a fairly straightforward workflow and running into issues, was hoping you might know!
I'm trying to put together an app that would allow users to "click along" a series of highway segments and, when the user hits a distance threshold (5 miles), they can then "submit" the selected segments to an identify task that would return all the ObjectIDs of the features that are overlaid. Any ideas?
Check out the "Select with Feature Layer" example. You can digitize a line and select intersecting segments. The tricky part might be setting the 5 mile threshold...not sure how I would do that.
Guys, you need to look at this thread where I show how to limit the units available in the Measurement widget.
Robert - I assume you are referring to one of these threads?
Measurement Widget: disable tooltips & units
Measurement in meters in Javascript
Thanks for chiming in, it prompted me to revisit this topic. I played with this in the Sandbox sample for the Measurement Widget and was able to get to remove unwanted Units.
Farewell, Nautical Miles and Square Yards. I hope to never see you in my applications again