0

我在我的 vb.net 2010 应用程序上使用 Google Maps API V3。我http://maps.google.com/maps/geo?output=csv&key=MYAPIKEY&q= 46 long street, kempton park直接在网络浏览器上 进行了测试,但610,0,0,0出现错误。我的应用程序的重点是从地址获取 gps 坐标,并从给定的 gps 坐标获取地址。我尝试生成一个新的浏览器密钥,但仍然无法正常工作。提前致谢。请参考以下代码:

有人可以告知为什么 Google Maps API 返回此610,0,0,0错误

Public Function GetLatLon(ByVal addr As String) As LatLon
    Dim url As String = "http://maps.google.com/maps/geo?output=csv&key=MYAPIKEY" & addr
    Dim request As System.Net.WebRequest = WebRequest.Create(url)
    Dim response As HttpWebResponse = request.GetResponse()
    If response.StatusCode = HttpStatusCode.OK Then
        Dim ms As New System.IO.MemoryStream()
        Dim responseStream As System.IO.Stream = response.GetResponseStream()
        Dim buffer(2048) As Byte
        Dim count As Integer = responseStream.Read(buffer, 0, buffer.Length)
        While count > 0
            ms.Write(buffer, 0, count)
            count = responseStream.Read(buffer, 0, buffer.Length)
        End While
        responseStream.Close()
        ms.Close()
        Dim responseBytes() As Byte = ms.ToArray()
        Dim encoding As New System.Text.ASCIIEncoding()
        Dim coords As String = encoding.GetString(responseBytes)
        Dim parts() As String = coords.Split(",")
        Return New LatLon(Convert.ToDouble(parts(2)), Convert.ToDouble(parts(3)))
    End If
    Return Nothing
End Function 
4

1 回答 1

0

您不需要查看 HTML 源代码,但在这里... https://maps.googleapis.com/maps/api/geocode/xml?address=terracin,via+roma+100&sensor=false

我使用我的地址

看看它是一个谷歌服务,你可以得到 XML 的位置

干杯

于 2013-05-30T13:23:59.457 回答