AnsweredAssumed Answered

ArcGIS interactive KML layer

Question asked by rparham on Oct 31, 2016
Latest reply on Oct 31, 2016 by rparham

I am working on an ArcGIS map. I need to be able to interact with KML layers.

 

Here is a minimal version of my current code:

 

    map = new Map("map", {
      basemap: "topo",
      center: [-108.663, 42.68],
      zoom: 6
    });
    parser.parse();

 

    var kmlUrl = "https://dl.dropboxusercontent.com/u/2142726/esrijs-samples/Wyoming.kml";
    var kml = new KMLLayer(kmlUrl);
    map.addLayer(kml);
    kml.on("load", function() {
      console.log("done");
    });

 

[Here is a fiddle](https://plnkr.co/edit/vtB24sZbZGaeHCEsU1ch?p=preview)

 

I'm looking to achieve something more like [this map](https://developers.arcgis.com/javascript/3/samples/fl_hover/), which outlines the layer on hover. (This example is from the [FeatureLayer](https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html) class, but my KML is dynamically generated. Is it possible to create a featurelayer dynamically from KML data?)

 

How can I listen for mouseover on a KML shape?

Outcomes