Select to view content in your preferred language

Nautical Miles Units for Measurement Tool

1177
4
04-08-2013 11:22 AM
WillMcClintock
Deactivated User
Hello!

I am interested in setting the units for the measurement tool to "nautical miles" but this doesn't seem to be an option. Does anyone know if this is possible and/or if it is slated to come out with an upcoming release of the Javscript API?
0 Kudos
4 Replies
DerekWicks1
Deactivated User
Hi Will,

Just wondering if you or anybody else has figured out a solution on how to do this? I was about to post the exact same question.

Derek
0 Kudos
WillMcClintock
Deactivated User
Unfortunately not! Given the Ocean Initiative at Esri, I think we should push this through as a high priority. I'll see if I can get some movement through other channels.

-Will
0 Kudos
JianHuang
Deactivated User
Measurement widget already has �??Nautical Miles�?� built in. We just didn�??t expose it. In order to show it on the drop down menu, you just need to add a menu item. And the widget will handle all the conversions and book keeping work.
Here is the code snippet:
                 dojo.connect(measurement.distance, "onClick", function(){
                   if (this.checked) {
                     var nauticalMenuItem = new dijit.MenuItem({
                       label: "Nautical Miles",
                              onClick: function(){
                                measurement._switchUnit("Nautical Miles");
                       }
                     });
                     measurement.unit.dropDown.addChild(nauticalMenuItem);
                   }              
                 });

That�??s all the code you need for distance measurement. In case you need the area measurement tool work with nautical miles as well, here is the code:
                //from acres to square nautical miles
                 measurement.unitDictionary["Square Nautical Miles"] = 0.001179874545293396;
                 dojo.connect(measurement.area, "onClick", function(){
                   if (this.checked) {
                     var nauticalAreaMenuItem = new dijit.MenuItem({
                       label: "Square Nautical Miles",
                              onClick: function(){
                                measurement._switchUnit("Square Nautical Miles");
                       }
                     });
                     measurement.unit.dropDown.addChild(nauticalAreaMenuItem);
                   }              
                 });
0 Kudos
DerekWicks1
Deactivated User
Thanks Jian!
0 Kudos