今天帮助朋友找人时研究了下手机定位,先说一下C网的。
Andriod手机可以用*#*#4636#*#* 或 *983*0#手动获取手机登记的基站位置Lat Long
如图
得到LAT和LONG后,用下面的代码获取对应的经纬度
-
/**
-
* Latitude is a decimal number asspecified in 3GPP2 C.S0005-A v6.0.
-
* It is represented in units of 0.25seconds and ranges from -1296000
-
* to 1296000, both values inclusive(corresponding to a range of -90
-
* to +90 degrees). Integer.MAX_VALUEis considered invalid value.
-
*/
-
-
/**
-
* Longitude is a decimal number asspecified in 3GPP2 C.S0005-A v6.0.
-
* It is represented in units of 0.25seconds and ranges from -2592000
-
* to 2592000, both values inclusive(corresponding to a range of -180
-
* to +180 degrees).Integer.MAX_VALUE is considered invalid value.
-
*/
-
#include <stdio.h>
-
int main()
-
{
-
-
int iLat = 0x6a1d0;
-
int iLong = 0x1a65e2;
-
double fLat = (double)iLat * 90 / 1296000;
-
double fLong =(double)iLong * 180 / 2592000;
-
printf("lat=%lf long=%lf\n", fLat, fLong);
-
}
$ ./a.out
lat=30.183333 long=120.140139
好了,现在直接用Google地图/地球搜索
30.183333 120.140139,怎么样,找到了吧,呵呵
上面只是验证过程,在手机中手动获取LAT和LONG,程序实现可以调用现成的函数获取对应经纬度的整数值,然后再转换成
经纬度
CdmaCellLocation.getBaseStationLatitude()
CdmaCellLocation.getBaseStationLongitude()
从核心网侧获取用户位置的信令应该也有的,等改天有时间再补上。
阅读(382) | 评论(0) | 转发(0) |