Latitude and Longitude Display on Mobile Devices

1015
3
02-09-2012 06:35 AM
NDFResource
New Contributor
I have an arcgisonline app developed to assist wildland fire fighters. I have 2 questions:

1) When I try an get latitude and longitude for a point on a mobile device (Ipad or android), it displays as decimal degrees. Is there a way to display it on mobile devices in degrees minutes seconds.

2) Is there or will there be functionality to be able to enter a latitude and longitude and have the app zoom to that location

Thanks

John
Tags (2)
0 Kudos
3 Replies
MichaelWaltuch
New Contributor
>1) When I try an get latitude and longitude for a point on a mobile device (Ipad or android), it displays as decimal degrees. Is there a way to display it on mobile devices in degrees minutes seconds.

Not at the present time.

>2) Is there or will there be functionality to be able to enter a latitude and longitude and have the app zoom to that location

On the list.
0 Kudos
SteveGoates1
New Contributor II
Wondering if it is possible yet to display Minutes / Seconds on mobile devices?
0 Kudos
BrianLocke
Occasional Contributor II

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

0 Kudos