通过 cellId、LAC、MCC 和 MNC Android 从当前移动站获取相邻小区塔的距离和方向?

Get neighbor cell tower distance and direction from current mobile station by cellId,LAC,MCC and MNC Android?

我想制作一个应用程序来查找接收到的信号强度和邻近的手机信号塔。我成功地获得了每个相邻手机信号塔的 cellid、mnc、mcc、lac 和信号强度。但我想通过使用 cellid、lac、mnc、mcc 来计算每个手机信号塔的距离和与当前手机的方向。我不想使用互联网连接来做到这一点。 可以计算吗?? 如果可能,请提出建议。

如果没有互联网连接,这将很困难(不可能?)。但是,如果您能够使用互联网连接,则可以使用 Mozilla Location Service 查找邻居小区 ID(您提到您已经获得)并获得 latitude/longitude.

关于获取手机的当前位置,SO 上有很多答案。这是一个很好的例子:Get current latitude and longitude android

现在一旦你有了手机 lat/long 和相邻小区 lat/long,使用余弦定律计算相邻小区和手机之间的距离:

d = acos( sin φ1 ⋅ sin φ2 + cos φ1 ⋅ cos φ2 ⋅ cos Δλ ) ⋅ R

可以这样实现,例如:

var φ1 = lat1.toRadians(), φ2 = lat2.toRadians(), Δλ = (lon2-lon1).toRadians(), R = 6371e3; // gives d in metres
var d = Math.acos( Math.sin(φ1)*Math.sin(φ2) + Math.cos(φ1)*Math.cos(φ2) * Math.cos(Δλ) ) * R;

关于标题,使用这个公式:

θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
where   φ1,λ1 is the start point, φ2,λ2 the end point (Δλ is the difference in longitude)

可以这样实现,例如:

var y = Math.sin(λ2-λ1) * Math.cos(φ2);
var x = Math.cos(φ1)*Math.sin(φ2) -
        Math.sin(φ1)*Math.cos(φ2)*Math.cos(λ2-λ1);
var brng = Math.atan2(y, x).toDegrees();

(Distance/heading 公式由 website)

查找相邻小区的信号强度是另一回事。根据技术 (LTE/WCDMA/GSM) 这可能会也可能不会。 Here 是如何执行此操作的一个示例,但它可能不适用于所有技术类型。