Google maps 谷歌地图切换覆盖与复选框

Google maps 谷歌地图切换覆盖与复选框,google-maps,google-maps-api-3,Google Maps,Google Maps Api 3,我卡住了。我的复选框无法正常工作。我想用复选框切换两个图层。这两个图层在加载时应处于打开状态(选中复选框),然后在未选中时关闭。很简单,我知道,但是尽管我看了很多工作示例并检查了所有的帖子,我还是无法让它发挥作用。我发现的大部分东西都是它如何与KML和fusion表一起工作的。我有一个按钮可以用的东西,但是这个复选框不能用 下面是带有复选框的下拉框的代码 tileNEX = new google.maps.ImageMapType({ getTileUrl: functi

我卡住了。我的复选框无法正常工作。我想用复选框切换两个图层。这两个图层在加载时应处于打开状态(选中复选框),然后在未选中时关闭。很简单,我知道,但是尽管我看了很多工作示例并检查了所有的帖子,我还是无法让它发挥作用。我发现的大部分东西都是它如何与KML和fusion表一起工作的。我有一个按钮可以用的东西,但是这个复选框不能用

下面是带有复选框的下拉框的代码

tileNEX = new google.maps.ImageMapType({
            getTileUrl: function(tile, zoom) {
                return "http://mesonet.agron.iastate.edu/cache/tile.py/1.0.0/nexrad-n0q-900913/" + zoom + "/" + tile.x + "/" + tile.y +".png?"+ (new Date()).getTime();
            },
            tileSize: new google.maps.Size(256, 256),
            opacity:0.50,
            name : 'NEXRAD',
            isPng: true
        });


       goes = new google.maps.ImageMapType({
            getTileUrl: function(tile, zoom) {
                return "http://mesonet.agron.iastate.edu/cache/tile.py/1.0.0/goes-ir-4km-900913/" + zoom + "/" + tile.x + "/" + tile.y +".png?"+ (new Date()).getTime();
            },
            tileSize: new google.maps.Size(256, 256),
            opacity:0.50,
            name : 'GOES NA Vis',
            isPng: true
        });

        //create the check box items
        var radarOptions = {
                gmap: map,
                title: "This allows for selection/toggling on/off Radar layer",
                id: "radarCheck",
                label: "Radar",
                action: function(){
                if (map.overlayMapTypes.length==0) {
                  map.overlayMapTypes.push(null); // create empty overlay entry
                  map.overlayMapTypes.setAt("1",tileNEX);
                }
                else {
                    map.overlayMapTypes.clear();
                }

            }
}

        var check1 = new checkBox(radarOptions);

        var radarAnimate = {
                gmap: map,
                title: "This allows for selection/toggling on/off Animated Radar",
                id: "radarAnimate",
                label: "Animate Radar",
                action: function(){
                    alert('Function is coming soon');
                }
        }
        var check2 = new checkBox(radarAnimate);

        var satOptions = {
                gmap: map,
                title: "This allows for selection/toggling on/off Satelite layer",
                id: "satCheck",
                label: "Satellite",
                action: function(){
                if (map.overlayMapTypes.length==0) {
                  map.overlayMapTypes.push(null); // create empty overlay entry
                  map.overlayMapTypes.setAt("1",goes);
                }
                else {
                    map.overlayMapTypes.clear();
                }

            }
}
        var check3 = new checkBox(satOptions);

        //create the input box items

        //possibly add a separator between controls
        var sep = new separator();

        //put them all together to create the drop down
        var ddDivOptions = {
            items: [sep, check1, check2, check3],
            id: "myddOptsDiv"
        }
        //alert(ddDivOptions.items[1]);
        var dropDownDiv = new dropDownOptionsDiv(ddDivOptions);

        var dropDownOptions = {
                gmap: map,
                name: 'Options',
                id: 'ddControl',
                title: 'A custom drop down select with mixed elements',
                position: google.maps.ControlPosition.TOP_RIGHT,
                dropDown: dropDownDiv
        }

        var dropDown1 = new dropDownControl(dropDownOptions);


如果有人有建议,仍在寻找建议。我仍然无法找到一个有效的解决方案。嗨,问题仍然存在吗?当加载有地图的页面时,我有一些javascript错误。。。未捕获类型错误:无法设置未定义wundermap的属性'getPrefs'。min.js:8969未捕获类型错误:对象[Object Object]没有方法'removeOverlays'@SebP抱歉,我以为我删除了它,因为我采取了不同的方法并找到了另一个源来生成不同的层。现在的问题可以在这里找到。