在網上收集了一部分關于使用Google API進行手機定位的資料和大家分享

在網上收集了一部分關于使用Google API進行手機定位的資料和大家分享:

關于基站定位方面的介紹:

http://tech.c114.net/164/a140837.html

開發方面的幫助:

http://www.dotblogs.com.tw/kylin/archive/2009/08/09/9964.aspx

http://code.google.com/intl/zh-C ... ntation/staticmaps/

http://www.codeproject.com/KB/mobile/DeepCast.aspx

http://heresy.spaces.live.com/bl ... .0&sa=334916734

以上方法的流程一般如下:

通過RIL獲取CellTowerInfo----->通過google api獲取經緯度------->轉換成54或是地方坐標后在地圖上顯示位置



本人整理了代碼進行了測試,效果不是很好,使用的多普達S700,windows mobile 專業版 6.1 ,地點在上海,

定位結果如下

CELLID=1346
LAC=43060
MCC=460
MNC=0

從google獲取的坐標31.109,121.368,定位位置到了莘西路上

經過計算與實際位置直線距離在8KM左右



而通過Google Maps在手機上測試當前位置提示精度為18000m,呵呵,這個精度恐怕只能確定在那個城市了,個人認為:原因可能有以下幾點:

1.周圍基站分布較少或是真的很遠,上海的移動2G基站每年的數量都在減少,有時在公司的時候都會出現盲區,信號不是很好

2.直接通過cellid,lac,mcc,mnc等信息在Google上獲取的經緯度沒有經過誤差分析,沒有太大的精度可言

3.繞開中國移動運營商進行手機基站定位比較難,人家要靠這個賺錢的,當然也牽涉到國家安全,呵呵

4.RIL相關函數嚴格來說在Windows Mobile 上面都不是必須被實現的

下面是我的代碼和注釋,有些地方還是不能理解:



??1? ? public class RIL
??2? ???{
??3? ?? ?? ?//CellTower信息
??4? ?? ?? ?private static string celltowerinfo = "";
??5
??6? ?? ?? ?//通過RIL獲取CellID
??7? ?? ?? ?public static string GetCellTowerInfo()
??8? ?? ?? ?{
??9? ?? ?? ?? ? //初始化句柄
10? ?? ?? ?? ? IntPtr hRil = IntPtr.Zero;
11? ?? ?? ?? ? IntPtr hRes = IntPtr.Zero;
12
13? ?? ?? ?? ? //初始化結果變量
14? ?? ?? ?? ? celltowerinfo = "";
15
16? ?? ?? ?? ? //為一個Client初始化RIL? ?
17? ?? ?? ?? ? hRes = RIL_Initialize(1,
18? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???new RILRESULTCALLBACK(rilResultCallBack),
19? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???null,
20? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???0,
21? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???0,
22? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???out hRil);
23
24? ?? ?? ?? ? if (hRes != IntPtr.Zero)
25? ?? ?? ?? ? {
26? ?? ?? ?? ?? ???return "不能初始化RIL";
27? ?? ?? ?? ? }
28
29? ?? ?? ?? ? //獲取當前Phone使用的基站信息
30? ?? ?? ?? ? hRes = RIL_GetCellTowerInfo(hRil);
31
32? ?? ?? ?? ? waithandle.WaitOne();
33
34? ?? ?? ?? ? //解除RIL
35? ?? ?? ?? ? RIL_Deinitialize(hRil);
36
37? ?? ?? ?? ? return celltowerinfo;
38
39
40? ?? ?? ?}
41
42? ?? ?? ?private static AutoResetEvent waithandle = new AutoResetEvent(false);
43
44? ?? ?? ?public static void rilResultCallBack(uint dwCode,
45? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? IntPtr hrCmdID,
46? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? IntPtr lpData,
47? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? uint cdData,
48? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? uint dwParam)
49? ?? ?? ?{
50? ?? ?? ?? ? RILCELLTOWERINFO rilCellTowerInfo = new RILCELLTOWERINFO();
51
52? ?? ?? ?? ? //將數據lpData從非托管內存塊封送到rilCellTowerInfo托管對象
53? ?? ?? ?? ? Marshal.PtrToStructure(lpData, rilCellTowerInfo);
54
55? ?? ?? ?? ? celltowerinfo = rilCellTowerInfo.dwCellID + "-" + rilCellTowerInfo.dwLocationAreaCode + "-" +
56? ?? ?? ?? ?? ?? ?? ?? ?? ???rilCellTowerInfo.dwMobileCountryCode+"-"+rilCellTowerInfo.dwMobileNetworkCode;
57? ?? ?? ?? ?? ?
58? ?? ?? ?? ? //將事件狀態設置為終止狀態,允許一個或多個等待線程繼續
59? ?? ?? ?? ? waithandle.Set();
60? ?? ?? ?}
61? ?? ?? ?
62? ?? ?? ?public delegate void RILRESULTCALLBACK(uint dwCode,IntPtr hrCmdID,IntPtr lpData,uint cbData,uint dwParam);
63
64? ?? ?? ?public delegate void RILNOTIFYCALLBACK(uint dwCode,IntPtr lpData,uint cbData,uint dwParam);
65
66? ?? ?? ?//RIL基站信息類
67? ?? ?? ?public class RILCELLTOWERINFO
68? ?? ?? ?{
69? ?? ?? ?? ?? ? public uint cbSize;??
70? ?? ?? ?? ?? ? public uint dwParams;??
71? ?? ?? ?? ?? ? public uint dwMobileCountryCode;??
72? ?? ?? ?? ?? ? public uint dwMobileNetworkCode;??
73? ?? ?? ?? ?? ? public uint dwLocationAreaCode;??
74? ?? ?? ?? ?? ? public uint dwCellID;??
75? ?? ?? ?? ?? ? public uint dwBaseStationID;??
76? ?? ?? ?? ?? ? public uint dwBroadcastControlChannel;??
77? ?? ?? ?? ?? ? public uint dwRxLevel;??
78? ?? ?? ?? ?? ? public uint dwRxLevelFull;??
79? ?? ?? ?? ?? ? public uint dwRxLevelSub;??
80? ?? ?? ?? ?? ? public uint dwRxQuality;??
81? ?? ?? ?? ?? ? public uint dwRxQualityFull;??
82? ?? ?? ?? ?? ? public uint dwRxQualitySub;??
83? ?? ?? ?? ?? ? public uint dwIdleTimeSlot;??
84? ?? ?? ?? ?? ? public uint dwTimingAdvance;??
85? ?? ?? ?? ?? ? public uint dwGPRSCellID;??
86? ?? ?? ?? ?? ? public uint dwGPRSBaseStationID;??
87? ?? ?? ?? ?? ? public uint dwNumBCCH;??
88
89
90? ?? ?? ?}
91
92? ?? ?? ?/* 調用API? ?
93? ?? ?? ? * 初始化RIL? ?
94? ?? ?? ? * MSDN:? ?http://msdn.microsoft.com/zh-cn/library/aa919106(en-us).aspx */
95? ?? ?? ?[DllImport("ril.dll")]
96? ?? ?? ?private static extern IntPtr RIL_Initialize(uint dwIndex, RILRESULTCALLBACK pfnResult, RILNOTIFYCALLBACK pfnNotify, uint dwNotificationClasses, uint dwParam, out IntPtr lphRil);
97? ?? ?? ?[DllImport("ril.dll")]
98? ?? ?? ?private static extern IntPtr RIL_GetCellTowerInfo(IntPtr hRil);
99? ?? ?? ?[DllImport("ril.dll")]
100? ?? ?? ?private static extern IntPtr RIL_Deinitialize(IntPtr hRil);
101
102? ???}


之后是有關通信方面的,通過基站信息獲取經緯度(GOOGLE API)



代碼
??public class GMM
? ? {? ???
? ?? ?? ? static byte[] PostData(int MCC, int MNC, int LAC, int CID,??
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? bool shortCID)??
? ?? ?{
? ?? ?? ???
? ?? ?? ?? ?byte[] pd = new byte[]{??
? ?? ?? ?? ?? ? 0x00, 0x0e,??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,??
? ?? ?? ?? ?? ? 0x00, 0x00,??
? ?? ?? ?? ?? ? 0x00, 0x00,??
? ?? ?? ?? ?? ? 0x00, 0x00,??

? ?? ?? ?? ?? ? 0x1b,??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x11??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x15??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x19??
? ?? ?? ?? ?? ? 0x00, 0x00,??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x1f??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x23??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x27??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00, // Offset 0x2b??
? ?? ?? ?? ?? ? 0xff, 0xff, 0xff, 0xff,??
? ?? ?? ?? ?? ? 0x00, 0x00, 0x00, 0x00??
? ?? ?? ?? ?};??

? ?? ?? ?? ?bool isUMTSCell = ((Int64)CID > 65535);??

? ?? ?? ?? ?if (isUMTSCell)??
? ?? ?? ?? ?? ? Console.WriteLine("UMTS CID.{0}", shortCID ???
? ?? ?? ?? ?? ???"Using short CID to resolve." : "");??
? ?? ?? ?? ?else??
? ?? ?? ?? ?? ? Console.WriteLine("GSM CID given.");??

? ?? ?? ?? ?if (shortCID)??
? ?? ?? ?? ?? ? CID &= 0xFFFF;? ?? ?/* Attempt to resolve the cell using the? ?

? ?? ?? ?? ?if ((Int64)CID > 65536) /* GSM: 4 hex digits, UTMS: 6 hex??
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?digits */
? ?? ?? ?? ?if ((Int64)CID > 65536)
? ?? ?? ?? ?? ? pd[0x1c] = 5;??
? ?? ?? ?? ?else??
? ?? ?? ?? ?? ? pd[0x1c] = 3;??

? ?? ?? ?? ?pd[0x11] = (byte)((MNC >> 24) & 0xFF);??
? ?? ?? ?? ?pd[0x12] = (byte)((MNC >> 16) & 0xFF);??
? ?? ?? ?? ?pd[0x13] = (byte)((MNC >> 8) & 0xFF);??
? ?? ?? ?? ?pd[0x14] = (byte)((MNC >> 0) & 0xFF);??

? ?? ?? ?? ?pd[0x15] = (byte)((MCC >> 24) & 0xFF);??
? ?? ?? ?? ?pd[0x16] = (byte)((MCC >> 16) & 0xFF);??
? ?? ?? ?? ?pd[0x17] = (byte)((MCC >> 8) & 0xFF);??
? ?? ?? ?? ?pd[0x18] = (byte)((MCC >> 0) & 0xFF);??

? ?? ?? ?? ?pd[0x27] = (byte)((MNC >> 24) & 0xFF);??
? ?? ?? ?? ?pd[0x28] = (byte)((MNC >> 16) & 0xFF);??
? ?? ?? ?? ?pd[0x29] = (byte)((MNC >> 8) & 0xFF);??
? ?? ?? ?? ?pd[0x2a] = (byte)((MNC >> 0) & 0xFF);??

? ?? ?? ?? ?pd[0x2b] = (byte)((MCC >> 24) & 0xFF);??
? ?? ?? ?? ?pd[0x2c] = (byte)((MCC >> 16) & 0xFF);??
? ?? ?? ?? ?pd[0x2d] = (byte)((MCC >> 8) & 0xFF);??
? ?? ?? ?? ?pd[0x2e] = (byte)((MCC >> 0) & 0xFF);??

? ?? ?? ?? ?pd[0x1f] = (byte)((CID >> 24) & 0xFF);??
? ?? ?? ?? ?pd[0x20] = (byte)((CID >> 16) & 0xFF);??
? ?? ?? ?? ?pd[0x21] = (byte)((CID >> 8) & 0xFF);??
? ?? ?? ?? ?pd[0x22] = (byte)((CID >> 0) & 0xFF);??

? ?? ?? ?? ?pd[0x23] = (byte)((LAC >> 24) & 0xFF);??
? ?? ?? ?? ?pd[0x24] = (byte)((LAC >> 16) & 0xFF);??
? ?? ?? ?? ?pd[0x25] = (byte)((LAC >> 8) & 0xFF);??
? ?? ?? ?? ?pd[0x26] = (byte)((LAC >> 0) & 0xFF);??

? ?? ?? ?? ?return pd;??
? ?? ???}
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?//GSM CID part */??

? ?? ? /// <summary>
? ?? ? /// 通過基站信息獲取經緯度
? ?? ? /// </summary>
? ?? ? /// <param name="args"></param>
? ?? ? /// <returns></returns>
? ?? ???static public string GetLatLng(string[] args)??
? ?? ? {??
? ?? ?? ?? ?if (args.Length < 4)??
? ?? ?? ?? ?{??
? ?? ?? ?? ?? ? return string.Empty;??
? ?? ?? ?? ?}??
? ?? ?? ?? ?string shortCID = "";? ?/* Default, no change at all */??
? ?? ?? ?? ?if (args.Length == 5)??
? ?? ?? ?? ?? ? shortCID = args[4].ToLower();??
? ?? ?? ?? ?try??
? ?? ?? ?? ?{??
? ?? ?? ?? ?? ? String url = "http://www.google.com/glm/mmap";??
? ?? ?? ?? ?? ? HttpWebRequest req = (HttpWebRequest)WebRequest.Create(??
? ?? ?? ?? ?? ?? ???new Uri(url));??
? ?? ?? ?? ?? ? req.Method = "POST";??

? ?? ?? ?? ?? ? int MCC = Convert.ToInt32(args[0]);??
? ?? ?? ?? ?? ? int MNC = Convert.ToInt32(args[1]);??
? ?? ?? ?? ?? ? int LAC = Convert.ToInt32(args[2]);??
? ?? ?? ?? ?? ? int CID = Convert.ToInt32(args[3]);??
? ?? ?? ?? ?? ? byte[] pd = PostData(MCC, MNC, LAC, CID,??
? ?? ?? ?? ?? ?? ???shortCID == "shortcid");??

? ?? ?? ?? ?? ? req.ContentLength = pd.Length;??
? ?? ?? ?? ?? ? req.ContentType = "application/binary";??
? ?? ?? ?? ?? ? Stream outputStream = req.GetRequestStream();??
? ?? ?? ?? ?? ? outputStream.Write(pd, 0, pd.Length);??
? ?? ?? ?? ?? ? outputStream.Close();??

? ?? ?? ?? ?? ? HttpWebResponse res = (HttpWebResponse)req.GetResponse();??
? ?? ?? ?? ?? ? byte[] ps = new byte[res.ContentLength];??
? ?? ?? ?? ?? ? int totalBytesRead = 0;??
? ?? ?? ?? ?? ? while (totalBytesRead < ps.Length)??
? ?? ?? ?? ?? ? {??
? ?? ?? ?? ?? ?? ???totalBytesRead += res.GetResponseStream().Read(??
? ?? ?? ?? ?? ?? ?? ?? ?ps, totalBytesRead, ps.Length - totalBytesRead);??
? ?? ?? ?? ?? ? }??

? ?? ?? ?? ?? ? if (res.StatusCode == HttpStatusCode.OK)??
? ?? ?? ?? ?? ?{??
? ?? ?? ?? ?? ?? ???short opcode1 = (short)(ps[0] << 8 | ps[1]);??
? ?? ?? ?? ?? ?? ???byte opcode2 = ps[2];??
? ?? ?? ?? ?? ?? ???int ret_code = (int)((ps[3] << 24) | (ps[4] << 16) |??
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???(ps[5] << 8) | (ps[6]));??
? ?? ?? ?? ?? ?? ???if (ret_code == 0)??
? ?? ?? ?? ?? ?? ?{??
? ?? ?? ?? ?? ?? ?? ?? ?double lat = ((double)((ps[7] << 24) | (ps[8] << 16)??
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | (ps[9] << 8) | (ps[10]))) / 1000000;??
? ?? ?? ?? ?? ?? ?? ?? ?double lon = ((double)((ps[11] << 24) | (ps[12] <<??
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? 16) | (ps[13] << 8) | (ps[14]))) /??
? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? 1000000;??
? ?? ?? ?? ?? ?? ?? ?? ?return lat + "|" + lon;??
? ?? ?? ?? ?? ?? ???}??
? ?? ?? ?? ?? ?? ???else??
? ?? ?? ?? ?? ?? ?? ?? ?return string.Empty;??
? ?? ?? ?? ?? ? }??
? ?? ?? ?? ?? ? else??
? ?? ?? ?? ?? ?? ???return string.Empty;??
? ?? ?? ?? ?}??
? ?? ?? ?? ?catch (Exception ex)??
? ?? ?? ?? ?{??
? ?? ?? ?? ?? ? MessageBox.Show(ex.ToString());??
? ?? ?? ?? ?? ? return string.Empty;??
? ?? ?? ?? ?}??
? ?? ???}??

? ? }


下面在介紹一種只要知道cellid和lac兩個參數就可以獲取經緯度的方法:



1??/// <summary>
2? ?? ?? ?/// 判斷是否正確獲取經緯度信息
3? ?? ?? ?/// </summary>
4? ?? ?? ?/// <param name="cellid">cellid</param>
5? ?? ?? ?/// <param name="lac">LocationAreaCode</param>
6? ?? ?? ?/// <param name="Lat">latitude</param>
7? ?? ?? ?/// <param name="Lng">longgitude</param>
8? ?? ?? ?/// <returns></returns>
9? ?? ?? ?public static bool LocateGooleMapApi(uint cellid, uint lac, out double Lat, out double Lng)
10? ?? ?? ?{
11? ?? ?? ?? ? HttpWebRequest request =(HttpWebRequest)WebRequest.Create("http://www.google.com/glm/mmap");
12? ?? ?? ?? ? request.Method = "POST";
13
14? ?? ?? ?
15? ?? ?? ?? ? byte[] byteArray = {0x00,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
16? ?? ?? ?? ?? ?? ?? ?? ? 0x65, 0x6E, // en
17? ?? ?? ?? ?? ?? ?? ?? ? 0x00, 0x07,
18? ?? ?? ?? ?? ?? ?? ?? ? 0x41, 0x6E, 0x64, 0x72, 0x6F, 0x69, 0x64,
19? ?? ?? ?? ?? ?? ?? ?? ? 0x00, 0x03,
20? ?? ?? ?? ?? ?? ?? ?? ? 0x31, 0x2E, 0x30, // 1.0
21? ?? ?? ?? ?? ?? ?? ?? ? 0x00, 0x03,
22? ?? ?? ?? ?? ?? ?? ?? ? 0x57, 0x65, 0x62, // web
23? ?? ?? ?? ?? ?? ?? ?? ? 0x1B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
24? ?? ?? ?? ?? ?? ?? ?? ? 0x00,0x00,0x00,0x00,0x03,0x00,0x00,
25? ?? ?? ?? ?? ?? ?? ?? ? 0xFF, 0xFF, 0xFF, 0xFF, // CellID
26? ?? ?? ?? ?? ?? ?? ?? ? 0xFF, 0xFF, 0xFF, 0xFF, // LAC
27? ?? ?? ?? ?? ?? ?? ?? ? 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
28? ?? ?? ?? ?? ?? ?? ?? ? 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
29
30? ?? ?? ?? ? // write CellID
31? ?? ?? ?? ? byte[] intByte = BitConverter.GetBytes(cellid);
32? ?? ?? ?? ? byteArray[48] = intByte[3];
33? ?? ?? ?? ? byteArray[49] = intByte[2];
34? ?? ?? ?? ? byteArray[50] = intByte[1];
35? ?? ?? ?? ? byteArray[51] = intByte[0];
36
37? ?? ?? ?? ? // write LAC
38? ?? ?? ?? ? intByte = BitConverter.GetBytes(lac);
39? ?? ?? ?? ? byteArray[52] = intByte[3];
40? ?? ?? ?? ? byteArray[53] = intByte[2];
41? ?? ?? ?? ? byteArray[54] = intByte[1];
42? ?? ?? ?? ? byteArray[55] = intByte[0];
43
44? ?? ?? ?? ? // set request
45? ?? ?? ?? ? request.ContentLength = byteArray.Length;
46? ?? ?? ?? ? Stream postStream = request.GetRequestStream();
47? ?? ?? ?? ? postStream.Write(byteArray, 0, byteArray.Length);
48? ?? ?? ?? ? postStream.Close();
49
50? ?? ?? ?? ? // Get the response.
51? ?? ?? ?? ? HttpWebResponse response = (HttpWebResponse)request.GetResponse();
52? ?? ?? ?? ? Console.WriteLine("[I] Request response: {0}", response.StatusDescription);
53
54? ?? ?? ?? ? // Read response
55? ?? ?? ?? ? Stream dataStream = response.GetResponseStream();
56? ?? ?? ?? ? BinaryReader BR = new BinaryReader(dataStream);
57? ?? ?? ?? ? // skip 3 byte
58? ?? ?? ?? ? BR.ReadByte();
59? ?? ?? ?? ? BR.ReadByte();
60? ?? ?? ?? ? BR.ReadByte();
61
62? ?? ?? ?? ? // check state
63? ?? ?? ?? ? if (0 == BR.ReadInt32())
64? ?? ?? ?? ? {
65? ?? ?? ?? ?? ???// read lat
66? ?? ?? ?? ?? ???byte[] tmpByte = new byte[4];
67? ?? ?? ?? ?? ???tmpByte[3] = BR.ReadByte();
68? ?? ?? ?? ?? ???tmpByte[2] = BR.ReadByte();
69? ?? ?? ?? ?? ???tmpByte[1] = BR.ReadByte();
70? ?? ?? ?? ?? ???tmpByte[0] = BR.ReadByte();
71? ?? ?? ?? ?? ???Lat = (double)(BitConverter.ToInt32(tmpByte, 0)) / 1000000D;
72
73? ?? ?? ?? ?? ???// read lng
74? ?? ?? ?? ?? ???tmpByte[3] = BR.ReadByte();
75? ?? ?? ?? ?? ???tmpByte[2] = BR.ReadByte();
76? ?? ?? ?? ?? ???tmpByte[1] = BR.ReadByte();
77? ?? ?? ?? ?? ???tmpByte[0] = BR.ReadByte();
78? ?? ?? ?? ?? ???Lng = (double)(BitConverter.ToInt32(tmpByte, 0)) / 1000000D;
79
80? ?? ?? ?? ?? ???BR.Close();
81? ?? ?? ?? ?? ???dataStream.Close();
82? ?? ?? ?? ?? ???response.Close();
83? ?? ?? ?? ?? ???return true;
84? ?? ?? ?? ? }
85? ?? ?? ?? ? else
86? ?? ?? ?? ? {
87? ?? ?? ?? ?? ???BR.Close();
88? ?? ?? ?? ?? ???dataStream.Close();
89? ?? ?? ?? ?? ???response.Close();
90? ?? ?? ?? ?? ???Lat = 0;
91? ?? ?? ?? ?? ???Lng = 0;
92? ?? ?? ?? ?? ???return false;
93? ?? ?? ?? ? }
94
95
96? ?? ?? ?}


最后只要用C#2008 建立一個新項目,添加webbrowser控件,添加一個按鍵代碼如下:



1? ?? ? Cursor.Current = Cursors.WaitCursor;
2? ?? ?? ?? ? string [] cellidFields = RIL.GetCellTowerInfo().ToString().Split('-');
3? ?? ?? ?? ?? ?
4? ?? ?? ?? ? string[] args ={
5? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???cellidFields[2],
6? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???"0",
7? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???cellidFields[1],
8? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???cellidFields[0]
9? ?? ?? ?? ?? ?? ?? ?? ?? ? };
10? ?? ?? ?? ? string[] latlng = GMM.GetLatLng(args).Split('|');
11
12? ?? ?? ?? ? Uri url = new Uri("http://maps.google.com/staticmap?&maptype=satellite&key=xxx&markers=" + latlng[0].ToString().Replace(',', '.') + "," + latlng[1].ToString().Replace(',', '.') + "&center=,&size=240x320&zoom=18");
13? ?? ?? ?? ? webBrowser1.Navigate(url);
14? ?? ?? ?? ? Cursor.Current = Cursors.Default;

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/388956.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388956.shtml
英文地址,請注明出處:http://en.pswp.cn/news/388956.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

background圖片疊加_css怎么讓兩張圖片疊加,不用background只用img疊加

展開全部css層疊圖片代碼&#xff1a;//這個層為外面的父層&#xff0c;只需設置相對位置樣式即可//這個為里e69da5e887aa3231313335323631343130323136353331333431363030面要疊加的層&#xff0c;只需設置絕對樣式//這個為層里面的內容圖片//這個為父層內容或者&#xff1a;擴…

“入鄉隨俗,服務為主” 發明者量化兼容麥語言啦!

5年時光 我們裹挾前行。發明者量化從篳路藍縷到步履蹣跚&#xff0c;從以“區塊鏈資產交易”為陣地&#xff0c;再到以“內外盤商品期貨”為依托。再到今天全面兼容“麥語言”。每一步&#xff0c;我們始終都在為建立一個優秀的量化交易平臺而努力。 什么是麥語言&#xff1f; …

自考數據結構和數據結構導論_我跳過大學自學數據科學

自考數據結構和數據結構導論A few months back, I decided I wanted to learn data science. In order to do this, I skipped an entire semester of my data science major.幾個月前&#xff0c;我決定要學習數據科學。 為此&#xff0c; 我跳過了數據科學專業的整個學期。 …

爬取LeetCode題目——如何發送GraphQL Query獲取數據

前言 GraphQL 是一種用于 API 的查詢語言&#xff0c;是由 Facebook 開源的一種用于提供數據查詢服務的抽象框架。在服務端 API 開發中&#xff0c;很多時候定義一個接口返回的數據相對固定&#xff0c;因此要獲得更多信息或者只想得到某部分信息時&#xff0c;基于 RESTful AP…

python中的thread_Python中的thread

測試代碼import threadingimport timedef do_thread_test():print start thread time:, time.strftime(%H:%M:%S)time.sleep(5)print stop thread time:, time.strftime(%H:%M:%S)threads []for i in range(2):thread1 threading.Thread(targetdo_thread_test)thread1.setDae…

--附加數據庫失敗

--附加數據庫失敗1.產生失敗的原因比如有個數據庫&#xff0c;名叫HIMS,它的數據文件HIMS_Data.mdf和日志文件HIMS_Log.ldf,都放在路徑c:/Program Files/Microsoft SQL Server/MSSQL/data/下。但是這個數據庫天天跑日志&#xff0c;會產生上G的日志&#xff0c;現在通過企業管理…

十三、原生爬蟲實戰

一、簡單實例 1、需求&#xff1a;爬取熊貓直播某類主播人氣排行 2、了解網站結構 分類——英雄聯盟——"觀看人數" 3、找到有用的信息 二、整理爬蟲常規思路 1、使用工具chrome——F12——element——箭頭——定位目標元素 目標元素&#xff1a;主播名字&#xff0c…

歸一化 均值歸一化_歸一化折現累積收益

歸一化 均值歸一化Do you remember the awkward moment when someone you had a good conversation with forgets your name? In this day and age we have a new standard, an expectation. And when the expectation is not met the feeling is not far off being asked “w…

sqlserver垮庫查詢_Oracle和SQLServer中實現跨庫查詢

一、在SQLServer中連接另一個SQLServer庫數據在SQL中&#xff0c;要想在本地庫中查詢另一個數據庫中的數據表時&#xff0c;可以創建一個鏈接服務器&#xff1a;EXEC master.dbo.sp_addlinkedserver server N別名, srvproductN庫名,providerNSQLOLEDB, datasrcN服務器地址EXEC…

Angular2+ typescript 項目里面用require

在typescript里面怎么使用require方法呢&#xff1f; const jQuery require(jquery); const fip require( fonticonpicker/fonticonpicker )( jQuery ); 如果什么都不做&#xff0c;直接在項目里面使用&#xff0c;會得到以下錯誤&#xff1a; Cannot find name require 以下…

機器學習實踐三---神經網絡學習

Neural Networks 在這個練習中&#xff0c;將實現神經網絡BP算法,練習的內容是手寫數字識別。Visualizing the data 這次數據還是5000個樣本&#xff0c;每個樣本是一張20*20的灰度圖片fig, ax_array plt.subplots(nrows10, ncols10, figsize(6, 4))for row in range(10):fo…

Microsoft Expression Blend 2 密鑰,key

Microsoft Expression Blend 2 密鑰&#xff0c;key&#xff0c;序列TJ2R3-WHW22-B848T-B78YJ-HHJWJ號

ethereumjs/ethereumjs-common-3-test

查看test能夠讓你更好滴了解其API文檔的使用 ethereumjs-common/tests/chains.js const tape require(tape) const Common require(../index.js)tape([Common]: Initialization / Chain params, function (t) {t.test(Should initialize with chain provided, function (st) …

mysql修改_mysql修改表操作

一&#xff1a; 修改表信息1.修改表名alter table test_a rename to sys_app;2.修改表注釋alter table sys_application comment 系統信息表;二&#xff1a;修改字段信息1.修改字段類型和注釋alter table sys_application modify column app_name varchar(20) COMMENT 應用的名…

機器學習實踐四--正則化線性回歸 和 偏差vs方差

這次實踐的前半部分是&#xff0c;用水庫水位的變化&#xff0c;來預測大壩的出水量。 給數據集擬合一條直線&#xff0c;可能得到一個邏輯回歸擬合&#xff0c;但它并不能很好地擬合數據&#xff0c;這是高偏差&#xff08;high bias&#xff09;的情況&#xff0c;也稱為“欠…

深度學習 推理 訓練_使用關系推理的自我監督學習進行訓練而無需標記數據

深度學習 推理 訓練背景與挑戰&#x1f4cb; (Background and challenges &#x1f4cb;) In a modern deep learning algorithm, the dependence on manual annotation of unlabeled data is one of the major limitations. To train a good model, usually, we have to prepa…

Android strings.xml中定義字符串顯示空格

<string name"str">字 符 串</string> 其中 就表示空格。如果直接在里面鍵入空格&#xff0c;無論多少空格都只會顯示一個。 用的XML轉義字符記錄如下&#xff1a; 空格&#xff1a; <string name"out_bound_submit">出 庫</strin…

WCF開發入門的六個步驟

在這里我就用一個據于一個簡單的場景&#xff1a;服務端為客服端提供獲取客戶信息的一個接口讀取客戶信息&#xff0c;來完成WCF開發入門的六個步驟。 1. 定義WCF服務契約 A. 項目引用節點右鍵添加引用。 B. 在代碼文件里&#xff0c;添加以下命名空間的引…

LOJ116 有源匯有上下界最大流(上下界網絡流)

考慮有源匯上下界可行流&#xff1a;由匯向源連inf邊&#xff0c;那么變成無源匯圖&#xff0c;按上題做法跑出可行流。此時該inf邊的流量即為原圖中該可行流的流量。因為可以假裝把加上去的那些邊的流量放回原圖。 此時再從原來的源向原來的匯跑最大流。超源超匯相關的邊已經流…

CentOS 7 使用 ACL 設置文件權限

Linux 系統標準的 ugo/rwx 集合并不允許為不同的用戶配置不同的權限&#xff0c;所以 ACL 便被引入了進來&#xff0c;為的是為文件和目錄定義更加詳細的訪問權限&#xff0c;而不僅僅是這些特別指定的特定權限。 ACL 可以為每個用戶&#xff0c;每個組或不在文件所屬組中的用…