skyillusion

KML Layer help.

Discussion created by skyillusion on Jun 23, 2012
Latest reply on Jul 9, 2012 by jeff.pace
Hi,
    I am sort of new to this. And I am having a problem 'importing' kml files into my base map. I am quite sure that my links for my kml files is public accessible, and have no idea what is wrong. I have followed the examples provided by the Arcgis javascript API with no avail. I am hoping to get some help here.

The following is the snippet of my javascript codes:

        dojo.require("esri.map");
        dojo.require("esri.layers.KMLLayer");
 
        var myMap, myTiledMapServiceLayer;
        function init() {
            myMap = new esri.Map("mapDiv");
            myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://www.onemap.sg/ArcGIS/rest/services/basemap/MapServer");
            myMap.addLayer(myTiledMapServiceLayer);
            var kmlUrl = 'http://dl.dropbox.com/s/h5hs78sf6tgoqol/polyclinics.kml';
            var kml = new esri.layers.KMLLayer(kmlUrl);
            myMap.addLayer(kml);


            dojo.connect(kml, 'onLoad', function () {
                dojo.style(dojo.byId('loading'), 'display', 'none');
            });

            dojo.connect(myMap, 'onLoad', function() {
            //resize the map when the browser resizes
                 dojo.connect(dijit.byId('mapDiv'), 'resize', map,map.resize);
            });
        }
        dojo.ready(init);

I have tried importing the hardcopy of the kml file to the onemap.sg server (they have a function to allow the overlaying of personal kml files) and it works perfectly.
I am also not sure if I need to set the extent of the map in order to get it to work. But as for now, the onemap's map is showing on my browser, but not the overlay.
Any help would be appreciated.

Outcomes