Search code examples
google-mapsgoogle-maps-api-3kmlgeojson

USGS Kml Layer is not displaying colors or sizes properly


I am applying a KML layer from USGS to the Google Maps app, which is supposed to display seismic activity in terms of magnitude and depth. The problem I'm having is that neither size of the circles or their color reflects the above-mentioned properties.

Here's what it looks like:

enter image description here

I've looked through the KML file they're providing and it appears to be fine, but I don't have the extensive experience to figure out if there is something off. The colors and scales appear to be set properly:

enter image description here

Here's the code (nothing special, I'm just applying the feed to the map):

function addKmlLayer(map) {
    var kml = new google.maps.KmlLayer('http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_month_depth.kml');
    kml.setMap(map);
}

USGS Feeds Page: http://earthquake.usgs.gov/earthquakes/feed/v1.0/kml.php

Is it something I am not setting on my side, something Google Maps API does not support or an error in the USGS KML syntax?


Solution

  • IconStyle/color and scale are not supported by google maps: https://developers.google.com/kml/documentation/kmlelementsinmaps

    Using external styles minimizes the size of these frequently changing feeds.

    USGS offers GeoJSON(P) feeds for embedding in javascript maps, as described on this page: https://developers.google.com/maps/tutorials/data/importing_data#requesting_jsonp

    USGS GeoJSON feeds are available at: http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php

    They can converted to GeoJSONP by appending a "p" to the url: http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_week.geojsonp