Loading KML with Tiled Map Service

3040
6
Jump to solution
07-29-2015 05:12 AM
jeremygoins
New Contributor

I'm new to the ArcGIS API. I have experience with Google Earth API so please bare with me on this question as it might be simple. Below is my attached codepen I can't figure out why the KML will not show up when I use the Tiled Map service with adding the KML. I suspect that it is being placed behind the REST map, but I'm not entirely sure.

Could someone point me in the right direction or provide some input.

A Pen by Captain Anonymous

V/r

Jeremy

0 Kudos
1 Solution

Accepted Solutions
ChrisSmith7
Frequent Contributor

Actually, I was incorrect... it's this bit of code that's preventing the KML from rendering:

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

But, you can still set-up the basemap in the map constructor as an alternative way to show the topo layer. If you are curious, here's how it would look:

    map = new Map("map", { 
      basemap: "topo"
    });

Many ways to skin a cat in the ArcGIS JSAPI!

A Pen by Captain Anonymous - Forked

View solution in original post

6 Replies
ChrisSmith7
Frequent Contributor

Jeremy,

Try setting your basemap in the map's constructor. That's one way to solve it!

0 Kudos
ChrisSmith7
Frequent Contributor

Actually, I was incorrect... it's this bit of code that's preventing the KML from rendering:

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

But, you can still set-up the basemap in the map constructor as an alternative way to show the topo layer. If you are curious, here's how it would look:

    map = new Map("map", { 
      basemap: "topo"
    });

Many ways to skin a cat in the ArcGIS JSAPI!

A Pen by Captain Anonymous - Forked

jeremygoins
New Contributor

I failed to mention I'm behind a firewall and need to utilize my ArcGIS REST server. I can see that the code wants to go to the services.arcgisonline.com REST server.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jeremy,

   Straight from the KMLLayer docs:

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).

0 Kudos
jeremygoins
New Contributor

I know and researched this information regarding the loading of KMLLayers. I have my KML rendering to the internal server with the esri/config code to achieve this.

However it is hit or miss when it renders so I assumed it was the REST services causing this problem or my coding.

0 Kudos
jeremygoins
New Contributor

Thank removined the on load piece resolved this issue and I can still use my REST services. Much appreciated.

0 Kudos