Display individual layers of a kml service

700
0
09-20-2013 06:11 AM
AndrewL
Occasional Contributor II
Is it possible to display individual layers of a kmz file on the map? Using this KMZ file from the NWS, I would like to display only Current Day 4 outlook through Current Day 8 outlook (5 folders total). "Current Day 4 outlook" is the name of the folder, and within that folder is a layer called "day_4otlk_20130920_prob"

Currently, those layers don't have any data due to low predictability, but in the future they will. This is the code taken from a sample with the KMZ file replaced. Thank you.

<script>
  var map;
  require([
    "esri/map", "esri/layers/KMLLayer",
    "dojo/parser", "dojo/dom-style", 

    "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
  ], function(
    Map, KMLLayer, 
    parser, domStyle
  ) {
    map = new Map("map", { 
      basemap: "topo",
      center: [-99, 42.68],
      zoom: 4
    });

    parser.parse();

    var kmlUrl = "http://www.spc.noaa.gov/products/outlook/SPC_outlooks.kmz";
    var kml = new KMLLayer(kmlUrl); 
    map.addLayer(kml);
    kml.on("load", function() {
      domStyle.set("loading", "display", "none");
    });
  });
</script>
0 Kudos
0 Replies