# KML not loading in cesuim Globe

**URL:** <https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188>\
**Category:** CesiumJS\
**Created:** [May 6, 2014, 5:54am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188 "2014-05-06T05:54:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 6, 2014, 5:54am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/1 "2014-05-06T05:54:14Z")

</div>

Is there other way to load the kml file on cesium globe because my kml file is not loading on the globe i have included my .html code

\<!DOCTYPE html\>  
\<html lang="en"\>  
\<head\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<meta charset="utf-8"\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"\> \<!-- Use Chrome Frame in IE --\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<meta name="description" content="Use the Viewer Widget to start building new applications or easily embed Cesium into existing applications."\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<meta name="cesium-sandcastle-labels" content="Beginner, Showcases"\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<title\>Cesium Demo\</title\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<script type="text/javascript" src="../Sandcastle-header.js"\>\</script\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/KmlDataSource.js"\>\</script\>  
&nbsp;&nbsp;\<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/Cesium.js"\>\</script\>  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;\<script type="text/javascript"\>  
&nbsp;&nbsp;&nbsp;&nbsp;require.config({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baseUrl : '../../../Source',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;waitSeconds : 60  
&nbsp;&nbsp;&nbsp;&nbsp;});  
&nbsp;&nbsp;&nbsp;&nbsp;\</script\>  
\</head\>  
\<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html" data-sandcastle-title="Cesium KML"\>  
\<style\>  
&nbsp;&nbsp;&nbsp;&nbsp;@import url(../templates/bucket.css);  
\</style\>  
\<div id="cesiumContainer" class="fullSize"\>\</div\>  
\<div id="loadingOverlay"\>\<h1\>Loading...\</h1\>\</div\>  
\<script id="cesium\_sandcastle\_script"\>  
var builtInKml = 'MY KML FILE';  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;function useBuiltInKml() {  
&nbsp;&nbsp;&nbsp;var viewer = new Cesium.Viewer('cesiumContainer');  
&nbsp;&nbsp;&nbsp;viewer.extend(Cesium.viewerDynamicObjectMixin);

&nbsp;&nbsp;&nbsp;&nbsp;alert("222");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var kmlDataSource = new Cesium.KmlDataSource();  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kmlDataSource.loadUrl(builtInKml, 'Built-in KML');  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewer.dataSources.add(kmlDataSource);  
&nbsp;&nbsp;&nbsp;&nbsp;Sandcastle.finishedLoading();  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Zoom in a little closer...  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Give the coordinates of your bounding box  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var west = Cesium.Math.toRadians(28.5263327654348);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var south = Cesium.Math.toRadians(77.38484280605337);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var east = Cesium.Math.toRadians(28.53339715213986);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var north = Cesium.Math.toRadians(77.39361675250349);  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var extent = new Cesium.Extent(west, south, east, north);  
&nbsp;&nbsp;&nbsp;&nbsp;viewer.scene.camera.viewExtent(extent);  
&nbsp;&nbsp;&nbsp;&nbsp;Sandcastle.finishedLoading();  
&nbsp;&nbsp;&nbsp;&nbsp;}  
useBuiltInKml()

\</script\>  
\</body\>  
\</html\>

Thanks

Vaibhav

---

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 6, 2014, 11:03am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/2 "2014-05-06T11:03:05Z")

</div>

I was going through the code and i found that check2 alert was not working which means there is a problem in line ( var kmlDataSource = new Cesium.KmlDataSource()😉

**Code:**

alert(“check1”);

var kmlDataSource = new Cesium.KmlDataSource();

alert(“check2”);

Regards,

vaibhav

---

<div class="post-metadata">

**Author:** ![Scott\_Hunter](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/scott_hunter/32/2006_2.png) [@Scott\_Hunter](https://community.cesium.com/u/Scott_Hunter)\
**Post date:** [May 6, 2014, 3:00pm UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/3 "2014-05-06T15:00:58Z")

</div>

KML support is not part of the released version yet. It’s being developed in the kml branch: [https://github.com/AnalyticalGraphicsInc/cesium/tree/kml](https://github.com/AnalyticalGraphicsInc/cesium/tree/kml) so you’ll have to clone from GitHub and build Cesium yourself.

---

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 6, 2014, 3:41pm UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/4 "2014-05-06T15:41:31Z")

</div>

Hi Scott,

Thanks for the Link. After building Cesium from the link i copied the Cesium.js and KmlDataSource.js in a separate folder and than ran the file but no change in output occurred.

I was going through the code and i found that check2 alert was not working which means there is a problem in line ( var kmlDataSource = new Cesium.KmlDataSource()😉

**Code:**

alert(“check1”);

var kmlDataSource = new Cesium.KmlDataSource();

alert(“check2”);

Regards,

vaibhav

---

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 10, 2014, 6:22am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/5 "2014-05-10T06:22:22Z")

</div>

I took clone of kml branch from GitHub : ([https://github.com/AnalyticalGraphicsInc/cesium/tree/kml](https://github.com/AnalyticalGraphicsInc/cesium/tree/kml))and builded Cesium now facing problem adding kmldatasources in the viewer.

kmlDataSource.loadUrl('C:/xampp/htdocs/kmlcesium/Apps/Temp.kml').then(function(){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert("555");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewer.dataSources.add(kmlDataSource);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert("666");  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewer.homeButton.viewModel.command();  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert("777")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})

It alerts till 555 . I am unable to understand whats the problem in viewer.dataSources.add(kmlDataSource);  
If needed i will upload my full code and KML file.

Regards,

vaibhav

---

<div class="post-metadata">

**Author:** ![Scott\_Hunter](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/scott_hunter/32/2006_2.png) [@Scott\_Hunter](https://community.cesium.com/u/Scott_Hunter)\
**Post date:** [May 12, 2014, 9:57pm UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/6 "2014-05-12T21:57:20Z")

</div>

Browsers cannot load data from file URLs like: ‘C:/xampp/htdocs/kmlcesium/Apps/Temp.kml’. You must host the KML file on an HTTP server.

---

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 15, 2014, 7:11am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/7 "2014-05-15T07:11:46Z")

</div>

I hosted my kml, as ‘[http://localhost/kmlcesium/KMLOutputSimple.kml](http://localhost/kmlcesium/KMLOutputSimple.kml)’. I build-ed the kml branch downloaded from github and tried to test cesium.js by running simple helloworld.html i figured out that it was not working that means cesium.js is not building properly.

regards,

vaibhav

---

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 15, 2014, 7:18am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/8 "2014-05-15T07:18:46Z")

</div>

I then downloaded already build folder of cesium-b27 and tested the same helloworld.html(from kml branch) by putting it in cesium-b27 folder and there it ran successfully . Am i thinking correct that cesium.js which i am using in kml branch is correct.

I will also like to mention that while manually building kml branch it builded absolutely error free, and after that i used the cesium.js

regards,

vaibhav

---

<div class="post-metadata">

**Author:** ![vaibhav\_kumar](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@vaibhav\_kumar](https://community.cesium.com/u/vaibhav_kumar)\
**Post date:** [May 21, 2014, 10:12am UTC](https://community.cesium.com/t/kml-not-loading-in-cesuim-globe/1188/9 "2014-05-21T10:12:51Z")

</div>

This is the error  
(  
1.Error: Script file not found: [http://localhost:81/cesium-kml/Build/Cesium/Workers/transferTypedArrayTest.js](http://localhost:81/cesium-kml/Build/Cesium/Workers/transferTypedArrayTest.js)

2.Error: Script file not found: [http://localhost:81/cesium-kml/Build/Cesium/Workers/cesiumWorkerBootstrapper.js](http://localhost:81/cesium-kml/Build/Cesium/Workers/cesiumWorkerBootstrapper.js)

) which i am getting after running helloworld.html example of kml branch. I went through the build file and i found this part of code in build.xml.

\<exclude name="cesiumWorkerBootstrapper.js" /\> \<exclude name="transferTypedArrayTest.js" /\> \<exclude name="createTaskProcessorWorker.js" /\>

why these js need to be excluded and if they are excluded than why the error for these js files is coming.

Regards,

vaibhav
