
Originally Posted by
derickson48
Could the localhost <snip> be causing the problem?
Yes, using localhost is the problem. Your KML file has to be publicly accessible to be used with the JS API. This is documented in the Working with KML Layers topic:
To add a KML file(.kml or .kmz) to a map, the KML must be available via a publicly accessible URL. Locally hosted or KML files inside a firewall are not supported.
The reason behind this requirement is that the KMLLayer class relies on a service hosted on ArcGIS.com to convert the actual KML to JSON. You can see this happening with firebug or chrome dev tools...here's the URL that's genereated from the simple KML layer sample:
Code:
http://utility.arcgis.com/sharing/kml?url=http://dl.dropbox.com/u/2654618/kml/Wyoming.kml&model=simple&folders=&outSR={"wkid":4326}&callback=dojo.io.script.jsonp_dojoIoScript2._jsonpCallback
Bookmarks