My Datafield contains an abstract location. I want to display this abstract location in MGRS or UTM format - rather than the default format in degrees. I am not sure how to do this, other than through the SDK-provided function "toGeoString" which requires that I have/use a Position object. However it seems the Position object is off limits to normal Datafields. Any alternatives or tricks? I guess I could look up how to convert degrees to UTM..
if (abstractLocation != null) {
//this is what I want to work, but gives a "Permission required" error
var abstractLocationForDisplayInMGRS = new Pos.Location({
:latitude => abstractLocation[0],
:longitude => abstractLocation[1],
:format => :degrees
});
var mgrsStr = abstractLocationForDisplayInMGRS.toGeoString(GEO_MGRS);
dc.drawText(5, 50, Gfx.FONT_MEDIUM, mgrsStr, Gfx.TEXT_JUSTIFY_LEFT);
//this works, but displays in lat/long degree format.
var latStr = abstractLocation[0].toString();
var lonStr = abstractLocation[1].toString();
dc.drawText( 5, 50, Gfx.FONT_MEDIUM, latStr, Gfx.TEXT_JUSTIFY_LEFT );
dc.drawText( 5, 70, Gfx.FONT_MEDIUM, lonStr, Gfx.TEXT_JUSTIFY_LEFT );
// Note: I am NOT displaying my Current Location, so I am not using the
// Activity.getActivityInfo().currentLocation etc method...
}