Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search 谷歌地图栏_Search_Maps - Fatal编程技术网

Search 谷歌地图栏

Search 谷歌地图栏,search,maps,Search,Maps,我试图简单地在自己的地图上添加一个谷歌搜索栏,但遇到了一些问题。我似乎无法让它工作!我试过map.enableGoogleBar;但这只是摆脱了我的KML层,并没有添加搜索框 代码如下: function initialize() { // set up startup options for the map // disabled double click as it was annoying and streetview control removed.

我试图简单地在自己的地图上添加一个谷歌搜索栏,但遇到了一些问题。我似乎无法让它工作!我试过map.enableGoogleBar;但这只是摆脱了我的KML层,并没有添加搜索框

代码如下:

 function initialize() {
        // set up startup options for the map 
        // disabled double click as it was annoying and streetview control removed. 
        var myOptions = {
            zoom: 10,
            //minZoom: 16,
            center: new google.maps.LatLng(50.45750, -3.84521),
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            disableDoubleClickZoom: true,
            streetViewControl: false,

            mapTypeControl: true,
            navigationControl: true,
            navigationControlOptions: {
                style: google.maps.NavigationControlStyle.ZOOM_PAN,
                position: google.maps.ControlPosition.TOP_LEFT
            },
            scaleControl: true,
                scaleControlOptions: {
                position: google.maps.ControlPosition.BOTTOM_LEFT
            }

            enableGoogleBar: true,
            googleBarOptions: {showOnLoad:true},
        };

        // create the new map
        map = new google.maps.Map(document.getElementById('map_canvas'),
            myOptions);
我看到了两个问题

myOptions对象中“enableGoogleBar”前面缺少一个逗号。 您正在使用GoogleMapsV3API并查看文档,但根本没有提到对enableGoogleBar选项的支持。它仅在谷歌地图API的第2版中可用。
啊,非常感谢!!我没有意识到Google bar函数没有延续到API V3: