2
votes

I have a Google Map in my App maniputated with jquery map plugin, I have put kml layer with:

$('#map_canvas').gmap('loadKML', 'kmlFile', 'http://www.mydomain.com/kmlfiles.kml');

I need set visible and not visible with an checkbox controls, there is any way to set visible false to kml layer with jquery map plugin?

Best

For reference of jquery map plugin click here

This is my code


if(m.checked){              
                $('#map_canvas').gmap('loadKML', 'railAccess', 'http://www.mydomain.org/propertiesch/js/kmlFile.kml');
            }else{
                $('#map_canvas').gmap('get','overlays>kmlFile').setMap(null);
            }       
1

1 Answers

3
votes

Welcome to another bad documented maps-library.

The overlays are stored in the overlays-property:

It has to be:

$('#map_canvas').gmap('get','overlays>kmlFile').setMap(null);