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