Sandra-Oh
Sandra-Oh

Reputation: 11

How Can I disable the pop up ballon in Google Maps using the API (V3)

I am using the Google Maps API V3 (so no embedding links) and I would like it so when the users click on one of my polygons (overlays) they don't see the white pop up balloon.

The contents of the balloon (as well as the co-ordinates) come from a KML file.

Here is what I am using to generate my map.

  <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
  <script type="text/javascript">
  function initialize() {
  var paris = new google.maps.LatLng(48.8581,2.3827 );
  var myOptions = {
  zoom: 4,
  center: paris,
  mapTypeId: google.maps.MapTypeId.ROADMAP
 }

 var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
 var france = new google.maps.KmlLayer('france.kml?v=45', {preserveViewport:true});
 var germany = new google.maps.KmlLayer('germany.kml?v=45', {preserveViewport:true});

 france.setMap(map);  
 germany.setMap(map);
  }
</script>

Upvotes: 1

Views: 1586

Answers (1)

JFrancis
JFrancis

Reputation: 365

Change your vars that load the KML's to something that looks like this:

var kmlLayer;

var kmlURL = 'http://www.yourwebsite.com/mapFileName.kml';
    var kmlOptions = {
        clickable: 0, // polygon ignores mouse clicks
        preserveViewport: 1
    };
kmlLayer = new google.maps.KmlLayer(kmlURL, kmlOptions);
kmlLayer.setMap(map);

Upvotes: 2

Related Questions