恩,第一版本的CELLID LAC转化地球坐标位置已经做好了,其实是个非常简单的测试.
原理基本是 通过手机得到 cellid和lac信息,也就是我们说的基站信息,然后根据这个提交给google的手机map接口,得到返回值就是坐标位置.
下面是部分VB的代码
LAC和CELLID作为Stream类型 传到google接口里面
Dim xmlstream
Set xmlstream = CreateObject("ADODB.Stream")
xmlstream.Mode = 3
xmlstream.open
xmlstream.Type = 1
xmlstream.Write buffer
xmlstream.SetEOS
xmlstream.position = 0
Dim bufTmp() As Byte
'bufTmp = xmlstream.Read(xmlstream.Size)
Dim xmlhttp
Set xmlhttp = CreateObject("Msxml2.XMLHTTP")
Call xmlhttp.open("POST", "http://www.google.com/glm/mmap ", False)
Call xmlhttp.setRequestHeader("Content-Type", "application/binary")
Call xmlhttp.setRequestHeader("Content-Length", xmlstream.Size)
Call xmlhttp.send(xmlstream.Read(xmlstream.Size))
Dim ps
ps = xmlhttp.responseBody
解释回收的数据
If 1 = 1 Then
If ps(0) = 0 And ps(1) = 14 And ps(2) = 27 Then
Dim ret_code As Long: ret_code = (ps(3) * 256 * 256 * 256) or (ps(4) * 256 * 256) or (ps(5) * 256) or (ps(6))
If ret_code = 0 Then
Dim lat As Double: lat = (((ps(7) * 256 * 256 * 256) or (ps(8) * 256 * 256) or (ps(9) * 256) or (ps(10)))) / 1000000
Dim lon As Double: lon = (((ps(11) * 256 * 256 * 256) or (ps(12) * 256 * 256) or (ps(13) * 256) or (ps(14)))) / 1000000
Label1 = lat & "," & lon
显示地图坐标
WebBrowser1.Navigate "http://maps.google.com/staticmap?center= " & Label1 & "&zoom=15&size=500x500&maptype=mobile"
End If
End If
End If
接着是程序的截图
这个是最简单的测试版,接着就开始做ASP的网络版本咯,启动......
GSM-Track 开发日志 GSM-Track开发 STEP 2
最新推荐文章于 2024-09-02 22:11:16 发布