'Google Maps API V3 - KML Layer and draw polygon

Thank you in advance for reading my problem.

I am currently creating a google maps and loading a klm file into it with geoXML3.

    <script type="text/javascript">
    $(function(){
         // create map
         var singapoerCenter=new google.maps.LatLng(45.677181, 14.119160);
 
         var myOptions = {
            zoom: 12,
            center: singapoerCenter,
            mapTypeId: google.maps.MapTypeId.ROADMAP
         }
          
         map = new google.maps.Map(document.getElementById('main-map'), myOptions);
         
          var myParser = new geoXML3.parser({
          map: map,
          singleInfoWindow: false
         });
        
         myParser.parse('./datafile.kml');                           
                     
    });
    </script>
 <div id="main-map" style="height: 400px;"></div>

that works fine so far. How can I now freely draw a new polygon on this existing layer?

thank you for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source