How to convert lat longs into degree format for Google Earth?

笑着哭i 提交于 2019-12-11 18:54:14

问题


I have lat/long coordinates for a list of ports. The coordinates are in a 2856N 05211E format (totally made those numbers up, btw). I'm trying to figure out how I can convert them to the degree format the Google Earth pluginuses in order to plot them on a map. Is there a parameter in the API that I could use to convert this? Any ideas would be appreciated.


回答1:


I'm assuming you can parse the values yourself. If not, then provide the language you wish to use.

The conversion is simple, Degrees/Min/Sec(DMS) to Decimal Degrees is

result = D + M/60 + S/3600;

If S or W,

result *= -1;

As always, do your own error checking.

-90 <= lat <= 90

-180 <= lon <= 180



来源:https://stackoverflow.com/questions/22636170/how-to-convert-lat-longs-into-degree-format-for-google-earth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!