I'm looking to add new coordinates and associated data points to a <gx:Track>
over a <NetworkControlLink>
in Google Earth. I've seen many examples on how to create <gx:Track>
s with <ExtendedData>
and how to do <Update>
s on generic <Point>
objects, but I haven't seen many that discuss both. The closest thing I could find is this link, which almost hits the nail on the head: http://groups.google.com/group/kml-support-advanced/browse_thread/thread/0d2cbefd087d576e?pli=1
Unfortunately, this link didn't get any responses, and the original poster didn't provide his orig_track.kml
file, otherwise I'd have been able to reverse-engineer what he was doing since he claims he discovered a solution.
Right now I'm defining a <Placemark>
like this in a file test.kml
:
<Placemark>
<name>Target</name>
<description>...</description>
<gx:Track id="orig_track">
<when>2012-05-29T22:45:00Z</when>
<when>2012-05-29T22:45:10Z</when>
<gx:coord>-84.396863 33.774566 285</gx:coord>
<gx:coord>-84.396917 33.774474 285</gx:coord>
<ExtendedData>
<SchemaData schemaUrl="#schemaId" id="testID">
<gx:SimpleArrayData name="sig_strength">
<gx:value>60</gx:value>
<gx:value>65</gx:value>
</gx:SimpleArrayData>
<gx:SimpleArrayData name="gps_lock">
<gx:value>true</gx:value>
<gx:value>true</gx:value>
</gx:SimpleArrayData>
</SchemaData>
</ExtendedData>
</gx:Track>
</Placemark>
I'm trying to update it by having a <NetworkLinkControl>
object that looks like this:
<NetworkLinkControl>
<Update>
<targetHref>test.kml<targetHref>
<Create>
<gx:Track targetId="orig_track_10003">
<when>2012-05-29T22:45:20Z</when>
<when>2012-05-29T22:45:30Z</when>
<when>2012-05-29T22:45:40Z</when>
<when>2012-05-29T22:45:50Z</when>
<gx:coord>-84.396992 33.774443 285</gx:coord>
<gx:coord>-84.397078 33.774421 285</gx:coord>
<gx:coord>-84.397188 33.774363 286</gx:coord>
<gx:coord>-84.397316 33.774298 287</gx:coord>
</gx:Track>
<SchemaData schemaUrl="test.kml#schemaId" targetId="testID">
<gx:SimpleArrayData>
<gx:value>60</gx:value>
<gx:value>60</gx:value>
<gx:value>65</gx:value>
<gx:value>65</gx:value>
</gx:SimpleArrayData>
<gx:SimpleArrayData>
<gx:value>true</gx:value>
<gx:value>true</gx:value>
<gx:value>true</gx:value>
<gx:value>true</gx:value>
</gx:SimpleArrayData>
</SchemaData>
</Create>
</Update>
</NetworkLinkControl>
I think my issue might be with how instances of <SchemaData>
are referenced. If I'm not mistaken, the <Schema>
defines what fields should be in an array, and when I define my <Placemark>
above, I instantiate the array with <SchemaData>
. I'm not sure how to grab the instance of the array I created and add elements to it using <Update>
and <Create>
. My <Schema>
looks like this:
<Schema name="schema" id="schemaId">
<gx:SimpleArrayField name="sig_strength" type="int">
<displayName>Signal Strength</displayName>
</gx:SimpleArrayField>
<gx:SimpleArrayField name="gps_lock" type="bool">
<displayName>GPS Lock Status</displayName>
</gx:SimpleArrayField>
</Schema>
I hope this was clear enough to understand! Thanks in advance for any guidance you may be able to provide.
I would suggest using a MultiTrack instead of a track and Updating that (add new Track children to extend the GPS path).
However, ExtendedData is another matter and I have not tested Updating this. If it does not work as you expect, leave a comment here on what happened and your updated code if applicable. Alternatively you can just Delete the ExtendedData and then re-Create it.
You may also be interested in the blog post from Sean Askay at http://www.unchartable.com/2011/05/google-io-high-performance-kml-for.html (The relevant video at about 17 minutes in, and the post has a link to some demo code with a working track update example).