I'm new with Google Maps API, but I've been trying a relatively simple task. Displaying polygons (from a kml and rendered with geoXml3) and then having the map zoom in on any location the user clicks on. However, when I click on the map, an info window pops up (no change in the zoom or map center). The google.maps.event.addListener function I'm attempting is relatively simple. Is it not doing anything because of the kml layer or the use of geoXml? Thanks!
<!DOCTYPE html>
<html>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js"></script>
<script src="http://geoxml3.googlecode.com/svn/trunk/ProjectedOverlay.js"></script>
<script>
function initialize() {
var options = {
center: new google.maps.LatLng(36.0897,-79.4456),
mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new google.maps.Map(document.getElementById("canvas"), options);
var geoXml = new geoXML3.parser({
map: map,
singleInfoWindow: true,
infoWindowOptions: {maxWidth:550,cornerRadius: 15},
});
geoXml.parse("HUC.kml");
google.maps.event.addListener(map, "click", function(event){
map.setZoom(15);
map.setCenter(event.latLng.lat(),event.latLng.lng());
});
}
$(document).ready(initialize);
</script>
<h1 style="font-size=16px;text-align:center;color:blue"> Select HUC8 Polygons </h1>
<div id="canvas" style="width:1000px; height:500px"></div>
<h4> <a href="http://www.unc.edu/~mmallard/">Return to homepage </a> </h4>
<footer>
<p>Posted by: Megan Mallard <br>
Purpose: To have users interact with map displayed with Google Maps Javascript API and kml parsed with geoXML. <br></p>
</footer>
<html>