You will need to create your own static methods to change these--At least I have not seen any in the runtimes ??
though its pretty easy -- here is a utility class that I created for c# should be pretty easy to convert to Objective C and Java
so the key is the MapPoint
public static string ddToDms(double coordinate, bool dm) { var neg = coordinate < 0d; var dms = string.Empty; coordinate = Math.Abs(coordinate); var d = Math.Floor(coordinate); coordinate -= d; coordinate *= 60; var m = Math.Floor(coordinate); coordinate -= m; coordinate *= 60; var s = Math.Round(coordinate); char pad; char.TryParse("0", out pad); var dd = d.ToString(); var mm = m.ToString().PadLeft(2, pad); var ss = s.ToString().PadLeft(2, pad); if (!dm) { dms = string.Format("{0}°{1}'{2}\"", dd, mm, ss); } else { var pMin = (s / 60) + m; var msFormat = string.Format("{0:0.####}", pMin); dms = string.Format("{0}°{1}'", dd, msFormat); }
if (neg) { dms = "-" + dms; } return dms
the bool is for Decimal minurtes if true will give you the Decimal Minutes
this is the static method that I created for C# but using the Java you would be able to call String.Split() returns an array and for Objective C
send the message [@string ComponentsSeperatedByString:@this is the char to separate by] to a NSArray *var
P.S. thanks Chris Bradberry I stole a lot of the original logic from him
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.