-2

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 Interactive Map

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

PBarnum
  • 15
  • 2
  • 7
  • If you just want remove the markers, download the [KMZ](https://developers.google.com/kml/documentation/kmzarchives) file and edit it to remove them. – geocodezip Jun 14 '14 at 01:57
  • @geocodezip I was hoping to avoid this if they ever decided to update the files. – PBarnum Jun 14 '14 at 04:59
  • You should check the KmlStatus of the KmlLayer. Two of your KMZ files are returning DOCUMENT_TOO_LARGE (even when I remove the `` tags and the extra ",0" in each coordinate) [fiddle](http://jsfiddle.net/LMtTx/2/) – geocodezip Jun 15 '14 at 11:37
  • @geocodezip Thanks for your help. It seems that downloading/editing/re-uploading is the only way to get rid of the markers. – PBarnum Jun 16 '14 at 17:02

1 Answers1

0

After a lot of searching around, I decided to use geocodezip's advice and edit the KMZ files myself. Here are the steps I took to accomplish this:

  1. Downloaded all the KMZ files.
  2. Extract all files from each KMZ file (.kml and .png files)
  3. Deleted all tags and extra ",0" coordinates.
  4. Split the two largest KML files into two files each.
  5. Rezipped the .kml and .png files back into KMZ files.

Everything loads and runs great. Thanks to geocodezip for the advice and the KmlStatus tip.

PBarnum
  • 15
  • 2
  • 7