I am trying to place a map on my site and load five different KMZ (not KML) files into it. The people over at USGS have made a great interactive map and are the providers of the KMZ files. I can load the map in just fine, but cannot figure out how to remove all of the pins that show up.
EDIT: Image of my map with pins.
Here is my code loading the KMZ files:
(function($) {
var map;
var srcArr = ['http://earthquake.usgs.gov/hazards/qfaults/KML/Historic.kmz',
'http://earthquake.usgs.gov/hazards/qfaults/KML/Holocene_LatestPleistocene.kmz',
'http://earthquake.usgs.gov/hazards/qfaults/KML/LateQuaternary.kmz',
'http://earthquake.usgs.gov/hazards/qfaults/KML/Mid_LateQuaternary.kmz',
'http://earthquake.usgs.gov/hazards/qfaults/KML/Quaternary.kmz'];
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(37.741102, -122.397510),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(map_canvas, map_options)
loadKmlLayer(srcArr, map);
}
function loadKmlLayer(srcArr, map) {
for(var i = 0; i < srcArr.length; ++i) {
var kmlLayer = new google.maps.KmlLayer(srcArr[i], {
suppressInfoWindows: false,
preserveViewport: true,
map: map
});
}
}
google.maps.event.addDomListener(window, 'load', initialize);
// To prevent against the map only displaying in the top left corner
$("li.S2").click(function () {
google.maps.event.trigger(map, 'resize');
});
})(jQuery);
USGS Provided KMZ Files clicking on the 'kml (Google Earth) files' link will direct you to the kmz files page. I just wanted to show other means of downloading the data.
Thanks,
Patrick