如何将经纬度转换为Google Earth的度数格式? [英] How to convert lat longs into degree format for Google Earth?

查看:142
本文介绍了如何将经纬度转换为Google Earth的度数格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对端口列表有纬度/经度坐标.坐标为2856N 05211E格式(将这些数字总计,顺便说一句).我试图弄清楚如何将它们转换为Google Earth插件使用的度数格式,以便在地图上绘制它们. API中是否有可用于转换此参数的参数?任何想法,将不胜感激.

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.

推荐答案

我假设您可以自己解析这些值.如果没有,请提供您要使用的语言.

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

转换很简单,度/分/秒(DMS)到小数度是

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

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

如果是S或W,

result *= -1;

一如既往,进行您自己的错误检查.

As always, do your own error checking.

-90< =纬度< = 90

-90 <= lat <= 90

-180< = lon< = 180

-180 <= lon <= 180

这篇关于如何将经纬度转换为Google Earth的度数格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆