我正在使用Google Maps api v3 .. 根据此Documentation,我可以在Example中获得任意两点之间的路径。
我不希望使用VB.Net获得相同的结果..我希望在服务器端处理中获得相同的结果(意味着想要获得Path [lat lon pair])。
我尝试过代码
Dim lat As Double = 17.38489
Dim lon As Double = 78.486939
Dim lat2 As Double = 20.296095
Dim lon2 As Double = 85.82459
'For counter As Integer = 0 To 1
Try
Dim myURL As String = "http://maps.googleapis.com/maps/api/directions/json?origin=" & lat.ToString("0.000000") & "," & lon.ToString("0.000000") & "&destination=" & lat2.ToString("0.000000") & "," & lon2.ToString("0.000000") & "&sensor=false"
Dim myRequest As HttpWebRequest = WebRequest.Create(myURL)
myRequest.Method = "GET"
' Add request headers
myRequest.KeepAlive = True
myRequest.Accept = "*/*"
myRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0;)"
myRequest.Headers.Add("Accept-Language: en-us")
myRequest.Referer = "http://www.google.com/mapmaker?ll=16.303005,81.05464&spn=0.021583,0.040684&z=15"
myRequest.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-sg")
'myRequest.ContentType = "application/x-www-form-urlencoded"
Dim c As Char = "c"
Dim sb As New StringBuilder()
' Send the request and get the response
Dim myResponse As HttpWebResponse = myRequest.GetResponse
Dim reader As StreamReader = New StreamReader(myResponse.GetResponseStream())
sb.Append(reader.ReadToEnd())
reader.Close()
myResponse.Close()
Dim s As String = sb.ToString()
Dim ds As String = s
Response.Write(s)
Catch ex As Exception
End Try
任何人都可以帮帮我..
答案 0 :(得分:0)
我很确定这个服务器端是否反对TOS?此外,对IP地址的请求数量有限制。如果你超过这个限制怎么办?您需要检查来自Google的错误消息并正常处理它们。如果您为该服务付费,那么可能会有更少的限制。