问题描述
我正在尝试使用 Google Geocoding API 和 VB.NET 从爱尔兰 Eircode 获取完整地址。我正在获取结果,但地址缺少街道级别,不知道为什么?
这是我的代码...我认为 Google 无法提供完整地址,还有其他方法吗?
Private Async Sub Button1_Click(sender As Object,e As EventArgs) Handles Button1.Click
Dim address = ""
Try
'***** Check Eircode First ******
If Me.tbEircode.Text = "" Then
MessageBox.Show("No Eircode,please correct")
Exit Sub
End If
MessageBox.Show(Me.tbEircode.Text & " Eircode sent to Google Maps")
'*************** Get them in order with | and destination address
Dim OrgAddress As String = ""
OrgAddress = Me.tbEircode.Text
address = "https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:F*****|country:IE&key=***************"
MsgBox(address)
Using client As New Net.Http.HttpClient(),result = Await client.GetAsync(address)
If result.IsSuccessstatusCode Then
Dim content = Await result.Content.ReadAsstringAsync
Dim response = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Response)(content)
Me.tbAddress1.Text = response.status
Me.tbAddress2.Text = response.formatted_address.ToString
Else
Me.tbAddress1.Text = "error downloading"
End If
End Using
Catch ex As Exception
MessageBox.Show(ex.Message,"Google distance Calculator")
End Try
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)