關於朱泰銓-個人資料



[ASP.NET]Google Map API 取得經緯度

 

分享一下程式碼

剛好用到這部份:-)    

這函數會回傳一個字串陣列

其中第二個元素就是經 第三個就是緯 丟到Googe MAP API後就可以運作了

 

  Function getxy() As String()       

         Dim address As String = 『你的地址』

        Dim apikey = 『你的API Key』

        Dim url = 『http://maps.google.com/maps/geo?q=』 & address & 『&output=csv&key=』 & apikey

        Dim myrequest As System.Net.HttpWebRequest = System.Net.WebRequest.Create(url)

        Dim mywebresponse As System.Net.WebResponse = myrequest.GetResponse()

        Dim mystream As IO.Stream = mywebresponse.GetResponseStream()

        Dim sr As IO.StreamReader = New IO.StreamReader(mystream, Encoding.Default)

        Return Split(sr.ReadToEnd, 『,』)

  End Function

2 comments to [ASP.NET]Google Map API 取得經緯度

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>