Google Maps Toggling Overlays With Checkbox -
i'm stuck. can't checkbox functional. toggle 2 layers checkbox. 2 layers should on when loaded (check box checked) , turned off when unchecked. simple, know, can't functional despite looking @ lots of working examples , checking posts. of stuff found how worked kml , fusion tables. have working kinda works button doesn't work check boxes.
here code drop down box check boxes.
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 check box items var radaroptions = { gmap: map, title: "this allows 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 selection/toggling on/off animated radar", id: "radaranimate", label: "animate radar", action: function(){ alert('function coming soon'); } } var check2 = new checkbox(radaranimate); var satoptions = { gmap: map, title: "this allows 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 input box items //possibly add separator between controls var sep = new separator(); //put them create 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 mixed elements', position: google.maps.controlposition.top_right, dropdown: dropdowndiv } var dropdown1 = new dropdowncontrol(dropdownoptions);
Comments
Post a Comment