作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我如何找出某个位置的经纬度的SPECIFIC E6 值。例如,我在谷歌上搜索了巴拉圭首都亚松森的 long-lat。它返回我:
巴拉圭亚松森的纬度和经度是 25°16' S, 57°40 W
现在我如何将这种 long-lat 格式转换为 android 理解的 long-lat 的 E6 格式? E6 到底是什么东西?
[附注我还用谷歌搜索了亚松森的 E6 long-lat.......没有运气]
最佳答案
第 1 步. 从 DMS 到十进制度数的转换 From Wikipedia
Given a DMS (Degrees, Minutes, Seconds) coordinate such as 87°43′41″ W, it's trivial to convert it to a number of decimal degrees using the following methods:
Total number of degrees
= 87Total number of seconds
= 43′41″ = (43*60 + 41*1) = 2621 seconds.The fractional part is total number of seconds divided by 3600
= 2621 / 3600 = 0.728056Add fractional degrees to the whole degrees to produce the final result
= 87 + 0.728056 = 87.728056.Since it is a West longitude coordinate, negate the result.
= -87.728056.
经纬度引用:
Lat. North = +
Lat. South = -
Long. East = +
Long. West = -
第 2 步。从十进制转换为微度(E6 格式) From SO discussion
MicroDegrees (the E6 format) = DecimalDegrees * 1e6
--- as mentioned in AndroidDevGuide as well
因此,
float lat = -23.4456f; //in DecimalDegrees
float lng = 45.44334f; //in DecimalDegrees
GeoPoint gp = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6));
关于android - 如何在 Android 上为谷歌地图获取 E6 格式的经度纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7049966/
我是一名优秀的程序员,十分优秀!