Select to view content in your preferred language

Loading KML

856
3
05-03-2012 08:34 PM
ChristopherPiggott
New Contributor
I am having trouble loading KML.  I'm surprised, because from the docs it looks like it should be really simple.  My init looks like this:

var map = new esri.Map('map')

var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);

var kmlUrl = 'https://myserver.something.com/maptest/status.kml';
var kml = new esri.layers.KMLLayer(kmlUrl);
map.addLayer(kml);



What I notice is that it doesn't ever hit my server to retrieve the kml file.

Do I need to somehow trigger a refresh so that it loads the kml?  Or is what I did above enough?

--Chris
0 Kudos
3 Replies
derekswingley1
Deactivated User
Is your KML file publicly accessible?
0 Kudos
RaphaelSiebenmann
Occasional Contributor
Is your KML file publicly accessible?


This is the second thread where I have read that the KML file needs to be publicly available.  I find it very frustrating that this is not explicitly mentioned in the documentation.  For example,

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/layers_kmlbuff...

and

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/layers_kml.html

Should probably be modified to mention this very important piece of information!
0 Kudos
KellyHutchins
Esri Frequent Contributor
Hi Raphael,

We do mention that the KML layer needs to be publicly accessible in the API reference (see the first paragraph):

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/kmllayer.htm

But I agree that we should probably add this info to the sample descriptions too. We'll work on getting this info added to the sample descriptions for a future release.
0 Kudos