Hey guys!
I'm puzzling something together based on the Sandcastle KML bike ride example. I got most of it working, except how to get the KML path stick to the terrain surface. The KML is exported straight out of GE, and has times embedded. See data at the bottom of this post (I've shortened it a bit).
The code I'm using is this:
var viewer = new Cesium.Viewer(‘cesiumContainer’);
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : ‘https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles’
});
viewer.scene.globe.depthTestAgainstTerrain = true;
var options = {
camera : viewer.scene.camera,
canvas : viewer.scene.canvas,
clampToGround : true
};
viewer.dataSources.add(Cesium.KmlDataSource.load('../myFile.kml', options))
.then(function(dataSource){
//do stuff
});
Yet the KML path is sunken into the ground and only now and then bits pop out of the terrain surface. Can anyone point me into the right direction how to get this to work? I have also tried it with removing the Z component from the KML file, as suggested in some posts, but that made it actually worse.
Thanks for your help,
Max
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>GPS device</name>
<snippet>Created 08/04/17 13:59:44</snippet>
<LookAt>
<gx:TimeSpan>
<begin>2016-12-05T19:00:00Z</begin>
<end>2016-12-05T19:46:08Z</end>
</gx:TimeSpan>
<longitude>172.116292</longitude>
<latitude>-41.665269</latitude>
<altitude>0</altitude>
<heading>0</heading>
<tilt>0</tilt>
<range>43678.030155</range>
</LookAt>
<Style id="multiTrack_n">
...
</Style>
<Folder>
<name>Tracks</name>
<Placemark id="tour">
<name>MyTrack</name>
<styleUrl>#multiTrack</styleUrl>
<gx:Track>
<when>2016-12-05T19:00:00Z</when>
<when>2016-12-05T19:00:02.8Z</when>
<when>2016-12-05T19:00:04.41Z</when>
...
<gx:coord>172.01701 -41.554678 27.57</gx:coord>
<gx:coord>172.017208 -41.553992 28.6</gx:coord>
<gx:coord>172.01754 -41.553676 29.92</gx:coord>
...
</gx:Track>
</Placemark>
</Folder>
</Document>
</kml>