Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Java to realize the minute-second conversion between longitude and latitude and degree in Android Geographic Information system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use Java to realize the longitude, latitude and degree conversion of Android GIS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

/ * * convert latitude and longitude into degree minute and second format * @ param du 116.418847 * @ return 116o 2507.85 "* / public static String changeToDFM (double du) {int du1 = (int) du; double tp = (du-du1) * 60; int fen = (int) tp String miao = String.format ("% .2f", Math.abs (tp-fen) * 60); return du1 + "°" + Math.abs (fen) + "'" + miao + "\" } / * degrees turn to latitude and longitude * @ param dms 116 °25 °7.85 "* @ return 116.418847 * / public static double changeToDu (String dms) {if (dms = = null) return 0; try {dms = dms.replace (","); String [] str2 = dms.split ("°") If (str2.length < 2) return 0; int d = Integer.parseInt (str2 [0]); String [] str3 = str2 [1] .split ("\"); if (str3.length < 2) return 0; int f = Integer.parseInt (str3 [0]); String str4 = str3 [1] .substring (0, str3 [1] .length ()-1) Double m = Double.parseDouble (str4); double fen = f + (m / 60); double du = (fen / 60) + Math.abs (d); if (d < 0) du =-du; return du;} catch (Exception e) {e.printStackTrace ();} return 0 } "how to use Java to achieve Android geographic information system longitude and latitude and degree minute-second conversion" content is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report