在半径100米范围内的选定位置周围获得100个纬度和经度

时间:2015-06-18 18:31:38

标签: java android google-maps

我正在开发基于位置的Android应用程序。它使用谷歌地图。目前,当我点击地图时,它会将地图上的引脚丢弃,然后我会获得该地点的纬度和长度。但是现在我需要一个大约100多个纬度和长度的列表,在100米范围内的选定位置周围。可以任何人建议我如何在该位置周围获得多个纬度和长度 谢谢

1 个答案:

答案 0 :(得分:0)

长度为1度纬度/长度的公式为

m1 = 111132.92;     // latitude calculation term 1
m2 = -559.82;       // latitude calculation term 2
m3 = 1.175;         // latitude calculation term 3
m4 = -0.0023;       // latitude calculation term 4
p1 = 111412.84;     // longitude calculation term 1
p2 = -93.5;         // longitude calculation term 2
p3 = 0.118;         // longitude calculation term 3

// Calculate the length of a degree of latitude and longitude in meters
latlen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) +
        (m4 * Math.cos(6 * lat));
longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) +
            (p3 * Math.cos(5 * lat));

要获得1米内的度数,请将其反转(用longlen和latlen除以1)。

圆的公式是x ^ 2 + y ^ 2 = radius ^ 2。所以你可以为x选择一个随机值[-100,100],为y选择[-radius ^ 2-x ^ 2,radius ^ 2-x ^ 2]。然后使用上面的转换因子将x转换为纬度,将y转换为经度。然后将这些金额添加到中心点。这将为您提供中心半径范围内的随机位置