How to prettily format GPS data in java/android? -


I'm getting GPS data 2 as double - a double for longitude, another double for the latte.

I form them as strings

form. (MGps.getLatitude (), position. FORMAT_MINUTES);

Although I want to tell it on Google Maps, as they say, 17 (here is the symbol for degree) 55 (here is the symbol for minutes) 23 (here Symbol is second)

How do I do this?

You have got Java implementation to do that conversion.

  // decimal latitude or longitude in two latitudes or longitude. 87.728056 String decodedMS (double coros) {String output, degree, minute, second; // modulus gets coordinated by one (MOD 1) coordinate. // In other words, after all decimal numbers, all the numbers are met. Mod = 87.728056% 1 == 0.728056 // // Get the integer part of further coordinates. In other words, the whole number of parts Eg eg IntPart = 87 Double Mod = Sync% 1; Int intPart = (int) coordination; // degree set for the value of intPart //e.g = "87" degree = String.valueOf (intPart); // Next time MOD1 degree 60, we can get integer part for minutes. / Find MOD1 of new coordinates to find numbers after / decimal point eg. Coordination = 0.728056 * 60 == 43.68336 // mod = 43.68336% 1 == 0.68336 // // Get the value of the integer part of further coordination. Eg eg IntPart = 43 coord = mod * 60; Mod = Sync% 1; IntPart = (int) coordination; // Set the distance for the price of minutes. Eg eg Minute = "43" minute = string.value (interpart); Do this again for // minutes / / e.g. Coordination = 0.68336 * 60 == 41.0016 // EG. IntPart = 41 coord = mod * 60; IntPart = (int) coordination; // Set the value of the differential second // eg Seconds = "41" second = string.whouf (interpart); // I use this format for Android but you can change it // Output = "87 / 1,43 / 1,41 / 1" output = degree + "/ 1," + minute + "/ 1," + seconds + "/ 1"; // Degree standard production ma? ² SA ³ // output = degree + "one degree" + minute + "'" + second + "\" "; return output;} / * * conversion in decimal DMS * * Input: latitude or longitude in DMS format (Example: N 43 ° 36 '15 .894 ") * Return: Latitude or Longitude in decimal format * Hemispyreumeridine = & gt; {W, E, S, N} * * / Public Double DMSTedimal (String hemispareomermedia, double degree, double minute, double seconds) {double lotron = 0; Double signe = 1.0; If ((hemispresomeriden == "w") || (hemispresomeriden == "s")) {signe = -1.0;} Letoron = sign * * (monastery, floor) + monastery. Floor (min) /60.0 + Seconds / 3600.0); Return (LatOrLon); }    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

jsp - Google line chart x-axis shrinks on transition -

java - Reaching JTextField in a DocumentListener -