简体   繁体   English

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

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

I want to make a application that find received signal strength and neighboring cell tower. 我想制作一个能够找到接收信号强度和相邻蜂窝塔的应用程序。 I am successfully get cellid,mnc,mcc,lac and signal strength of each neighboring cell tower. 我成功地获得了每个相邻细胞塔的细胞,mnc,mcc,lac和信号强度。 But I want to calculate distance of each cell tower and direction from current mobile by using cellid,lac,mnc,mcc. 但我想通过使用cellid,lac,mnc,mcc计算每个蜂窝塔的距离和当前移动的方向。 I don't want to use internet connection to do that. 我不想使用互联网连接来做到这一点。 Is it possible to calculate?? 有可能计算? Please suggest how if possible. 如果可能,请建议如何。

Without an internet connection, this would be difficult (impossible?). 没有互联网连接,这将是困难的(不可能?)。 However, if you are able to use an internet connection, you could lookup the neighbor cell id (which you mentioned you had already obtained) with the Mozilla Location Service and get a latitude/longitude. 但是,如果您能够使用互联网连接,则可以使用Mozilla定位服务查找相邻小区ID(您提到已经获得),并获得纬度/经度。

There are many answers on SO with regards to getting the current location of a mobile. 关于获取移动设备的当前位置,关于SO有很多答案。 Here is a good example: Get current latitude and longitude android 这是一个很好的例子: 获取当前的经纬度android

Now once you have the mobile lat/long and neighbor cell lat/long, use the Law of Cosines to find the distance between the neighbor cell and mobile: 现在,一旦你有移动lat / long和相邻单元lat / long,使用余弦定律来找到相邻单元和移动设备之间的距离:

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

which can be implemented like this, for example: 可以像这样实现,例如:

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;

With regards to the heading, use this formula: 关于标题,请使用以下公式:

θ = 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)

which can be implemented like this, for example: 可以像这样实现,例如:

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 formulae courtesy of this website ) (距离/标题公式由本网站提供

Finding the signal strength from a neighbor cell is another matter. 从相邻小区中寻找信号强度是另一回事。 Depending on the technology (LTE/WCDMA/GSM) this may or may not be possible. 取决于技术(LTE / WCDMA / GSM),这可能是也可能是不可能的。 Here is one example of how to do this, but it may not work this way for all tech types. 以下是如何执行此操作的一个示例,但对于所有技术类型,它可能无法正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM