1

I have brought over one of the demos ESRI javascript apps and hosted that on my local IIS instance.

I also have a folder I have turned into an application via IIS, so I have the following: enter image description here

The file at location http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz is fine, I can put it into a browser fine and it downloads, I can also load it into Googe Earth so the kml is good.

It is basically a copy of the results of this URL: http://sites.google.com/site/geined13/tours/Volcanoes_of_the_World.kmz?attredirects=0&d=1

My relevant code is as follows:

var kmlUrl = "http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz";

var kml = new KMLLayer(kmlUrl);

map.addLayer(kml);

kml.on("load", function() {
  domStyle.set("loading", "display", "none");
});

The layer coming from the URL http://sites.google.com/site/geined13/tours/Volcanoes_of_the_World.kmz?attredirects=0&d=1 works fine when used as follows:

var volcanoesOfTheWorldKmlUrl = "http://sites.google.com/site/geined13/tours/Volcanoes_of_the_World.kmz?attredirects=0&d=1";
var volcanoesOfTheWorldKml = new KMLLayer(volcanoesOfTheWorldKmlUrl);
map.addLayer(volcanoesOfTheWorldKml);

So I am guessing that to avoid cross site attacks it's like the Silverlight ESRI control, and you have to use a proxy (I have the same link http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz working fine in my Silverlight sandbox app, but using a proxy) or is it wrong?

EDIT :: Sorry my original post was a last minute rush job before I finished work last night. The basic problem is that it cannot see the kml file: enter image description here

The text is : dojo.io.script.jsonp_dojoIoScript1._jsonpCallback({"error":{"code":400,"message":"File not found. Wrong url or out of memory.","details":[]}});

The same url works fine just via a browser: http://localhost/TEST_KML_FILES/Volcanoes_of_the_World.kmz

  • Can you please clarify what the problem is? – GavinR Aug 24 '18 at 3:12
  • Sorry!, my post was a last minute rush job before I finished work last night. It basically complains that it cannot find the KML file. – KieronFlynn Aug 24 '18 at 8:34
  • Apologies Gavin, original question updated. – KieronFlynn Aug 24 '18 at 8:39
  • 1
    I was just looking at the docs on : developers.arcgis.com/javascript/3/jsapi/kmllayer.html I quote "Note: The KMLLayer uses a utility service from ArcGIS.com, therefore your kml/kmz must be publicly accessible on the internet. If your kml/kmz files are behind the firewall you will need to set the esriConfig.defaults.kmlService to your own utility service. (Requires Portal for ArcGIS)." Can this really be true? Is it the case that you cannot load KML files from your local filesystem during development, or from a within domain web app? It has to be from a publicly accessible site? – KieronFlynn Aug 24 '18 at 10:01
  • Yes, that doc is correct: "your kml/kmz must be publicly accessible on the internet" – Bjorn Svensson Aug 27 '18 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.