Display entire gx:Track KML file without animation.

426 views
Skip to first unread message

Arel English

unread,
Jul 4, 2018, 1:22:44 AM7/4/18
to cesium-dev
I'm trying to figure out how to just display the path of gx:track KML data without animation or anything. I can only figure out how to display track data with the animation, like in this sandcastle. I assume this is simple to do, but can't figure out what I'm missing. 

Ultimately, I'd like to be able to load a GeoJSON file, a few KML gps track files, and zoom to view the entire result.

Thanks

Gabby Getz

unread,
Jul 5, 2018, 3:50:24 PM7/5/18
to cesium-dev
Hi Arel,

You should be able to define a path with no animation with a LineString.

Thanks,
Gabby

Arel English

unread,
Jul 6, 2018, 2:06:27 PM7/6/18
to cesium-dev
The problem is that I'm not creating an XML file, I'm just trying to display a user imported XML file. Is there an option I can pass in or something to just tell Cesium to display the entire file instead of animating it? Can I set the clock to the last frame or something? 

Here is an example of what it looks like:

<?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">
  <Document>
    <open>1</open>
    <visibility>1</visibility>
    <Style id="trackStyle">
      <LineStyle>
        <color>ffDB9034</color>
        <width>4</width>
      </LineStyle>
      <PolyStyle>
        <color>80DB9034</color>
      </PolyStyle>
    </Style>
    <Style id="pathStyle">
      <LineStyle>
        <color>f8000080</color>
        <width>8</width>
      </LineStyle>
    </Style>
    <Placemark>
      <name>KIWI-KIWI</name>
      <styleUrl>#trackStyle</styleUrl>
      <gx:Track>
        <altitudeMode>absolute</altitudeMode>
        <extrude>1</extrude>
        <gx:interpolate>1</gx:interpolate>
        <when>2018-06-30T18:21:37.997Z</when>
        <gx:coord>-69.71025514422888 43.96415925123166 46.69718679700353</gx:coord>
        <when>2018-06-30T18:27:17.992Z</when>
        <gx:coord>-69.71027182421619 43.96415493455153 47.133793925706975</gx:coord>
        <when>2018-06-30T18:27:31.992Z</when>
        <gx:coord>-69.71026679507429 43.96415656902265 47.03692753688649</gx:coord>
        <when>2018-06-30T18:27:43.992Z</when>
        <gx:coord>-69.71027174039716 43.96415887404602 47.064260290892406</gx:coord>
        <when>2018-06-30T18:27:44.992Z</when>
        <gx:coord>-69.71027232713038 43.964158413041346 47.13305841729885</gx:coord>
        <when>2018-06-30T18:27:51.992Z</when>


Omar Shehata

unread,
Jul 6, 2018, 4:33:08 PM7/6/18
to cesium-dev
If you know when the last frame is (perhaps parsing it out of the input XML?) you can set Cesium's clock with:

 
viewer.clock.currentTime.secondsOfDay = <time in seconds>


Here's an example, where it starts at what I think is the end of the trail.

Arel English

unread,
Jul 6, 2018, 9:23:55 PM7/6/18
to cesium-dev
Nice!! Thanks for the suggestion! 

Arel English

unread,
Jul 7, 2018, 1:20:14 AM7/7/18
to cesium-dev
Thanks again for the suggestion. Instead of digging in to find the clock end time, I just put a very high number, and it works every time! 



On Friday, July 6, 2018 at 4:33:08 PM UTC-4, Omar Shehata wrote:

Omar Shehata

unread,
Jul 7, 2018, 12:22:47 PM7/7/18
to cesium-dev
Good to hear you figured out a simple way to do it, and thanks for posting it back here so others can find it!
Reply all
Reply to author
Forward
0 new messages