gx:track and dynamic updates

329 views
Skip to first unread message

Steven Clark

unread,
Aug 23, 2010, 10:41:10 AM8/23/10
to KML Developer Support - Advanced Support for KML
I love the new gx:track extension. I'm using it to display data sets
of the form (timestamp, lat, lon, alt, user_data_A, user_data_B, ...)
where user_data is things like battery voltage, etc., and it's working
great.

Now I want to make it a bit more dynamic. I've read about NetworkLinks
and updates (Create/Change/Delete) at
http://code.google.com/apis/kml/documentation/kml_21tutorial.html#updates
.
I have a simple example of this working with Placemarks.

Can I apply this to gx:tracks as well? If I have an initial file of
100 datapoints of (timestamp, lat, lon, alt, user_data_A,
user_data_B, ...) in gx:track format, and then I want to update it to
add 5 new datapoints, is this possible without resending all the old
data?
Would this be a "Create", or a "Change"?
Do the new data points go in the same track as the old one (so that
all 105 points can be plotted together in the elevation profile?
If I have the elevation profile graph open when the new points are
loaded, does it refresh automatically?

Steven Clark

unread,
Aug 23, 2010, 3:03:21 PM8/23/10
to KML Developer Support - Advanced Support for KML
Responding to my own thread here. A little bit of experimenting has
given the answer, which is:
yes, you can combine Updates with gx:track, and
yes the elevation graph auto-updates correctly.

This is what I did, and builds off the example here:
http://code.google.com/apis/kml/documentation/kmlreference.html#trackexample

<?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">
<NetworkLinkControl>
<Update>
<targetHref>http://192.168.1.105/~spc26157/orig_track.kml</
targetHref>
<Create>
<gx:Track targetId="origtrack">
<when>2010-05-28T02:02:57Z</when>
<when>2010-05-28T02:02:59Z</when>
<when>2010-05-28T02:03:01Z</when>
<when>2010-05-28T02:03:03Z</when>
<when>2010-05-28T02:03:05Z</when>
<gx:coord>-122.203100 37.375000 145.199997</gx:coord>
<gx:coord>-122.203000 37.375100 150.199997</gx:coord>
<gx:coord>-122.202900 37.375200 155.199997</gx:coord>
<gx:coord>-122.202800 37.375300 160.199997</gx:coord>
<gx:coord>-122.202700 37.375400 165.199997</gx:coord>
</gx:Track>

<gx:SimpleArrayData targetId="arraya">
<gx:value>105</gx:value>
<gx:value>100</gx:value>
<gx:value>95</gx:value>
<gx:value>90</gx:value>
<gx:value>85</gx:value>
</gx:SimpleArrayData>
<gx:SimpleArrayData targetId="arrayb">
<gx:value>165</gx:value>
<gx:value>160</gx:value>
<gx:value>155</gx:value>
<gx:value>150</gx:value>
<gx:value>145</gx:value>
</gx:SimpleArrayData>
<gx:SimpleArrayData targetId="arrayc">
<gx:value>185.0</gx:value>
<gx:value>190.0</gx:value>
<gx:value>195.0</gx:value>
<gx:value>200.0</gx:value>
<gx:value>205.0</gx:value>
</gx:SimpleArrayData>
</Create>

</Update>
</NetworkLinkControl>
</kml>
Reply all
Reply to author
Forward
0 new messages