如何修复此错误脚本?谷歌地图 [英] How to fix this error script ? Google maps

查看:112
本文介绍了如何修复此错误脚本?谷歌地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有显示经度和纬度的谷歌地图,也弹出错误脚本。



https://i.imgur.com/L0JjwYR.png [ ^ ]



我尝试过:



 私有  Sub  Form2_Load( ByVal 发​​件人作为系统。对象 ByVal  e  As  System.EventArgs)句柄  MyBase  .Load 
尝试
Dim mapquery 作为 StringBuilder
Dim 经度作为 字符串 = TextBox2.Text
Dim 纬度作为 字符串 = TextBox1.Text
mapquery.Append( https://maps.google.com/maps/@
WebBrowser1.Navigate(mapquery.ToString())
如果 TextBox1.Text<> 字符串 .Empty 然后
mapquery.Append(纬度+
结束 如果
如果 TextBox2.Text<> 字符串 .Empty 然后
mapquery.Append(经度+ ,20z
结束 如果
WebBrowser1.Navigate(mapquery.ToString)
Catch ex As 异常
MessageBox.Show(ex.Message)
结束 尝试
结束 Sub

解决方案

根据文档:

开发者指南  ; |&NBSP;地图网址  |  Google开发者 [ ^ ]



显示地图 - 启动没有标记或指示的Google地图:

https:// www.google.com/maps / @?api = 1& map_action = map& parameters



重要

参数api = 1标识此URL用于的地图URL的版本。每个请求都需要此参数。唯一有效的值是1.如果URL中不存在api = 1,则忽略所有参数



参数

查询(必填):定义要在地图上突出显示的地点。所有搜索请求都需要查询参数。

在您的代码中,您第一次尝试导航时只能访问没有参数的基本网址。

即使你确实建立了你没有API版本或其他命名的参数,只包含它们包含的数据。


我认为你得到了答案,感谢您分享这些信息。

I didnt show display of Google Map with longitude and latitude and also pop up the Error Script.

https://i.imgur.com/L0JjwYR.png[^]

What I have tried:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim mapquery As New StringBuilder
            Dim longitude As String = TextBox2.Text
            Dim Latitude As String = TextBox1.Text
            mapquery.Append("https://maps.google.com/maps/@")
            WebBrowser1.Navigate(mapquery.ToString())
            If TextBox1.Text <> String.Empty Then
                mapquery.Append(Latitude + ",")
            End If
            If TextBox2.Text <> String.Empty Then
                mapquery.Append(longitude + ",20z")
            End If
            WebBrowser1.Navigate(mapquery.ToString)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

解决方案

Per the documentation:
Developer Guide  |  Maps URLs  |  Google Developers[^]

Display a map — launch Google Maps with no markers or directions:
https://www.google.com/maps/@?api=1&map_action=map&parameters

Important
The parameter api=1 identifies the version of Maps URLs this URL is intended for. This parameter is required in every request. The only valid value is 1. If api=1 is NOT present in the URL, all parameters are ignored

Parameters
query (required): Defines the place(s) to highlight on the map. The query parameter is required for all search requests.

In your code, the first time you attempt to navigate it is only to the "base" url with no parameters at all.
Even when you do get it built up you do not have the API version or other parameters named, just the data they contain.


Well i thinks you got your answer thanks for sharing such information.


这篇关于如何修复此错误脚本?谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆