This project has moved and is read-only. For the latest updates, please go here.

gx:Track and ExtendedData

Jul 21, 2014 at 3:34 PM
Hello, I'm having trouble adding extended data to a gx:Track to general KML similar to the example below. I understadn that this extended data will appear in a popup in Google earth when you click on the track. Does anyone have an example of how to generate this?

Many thanks

Martin

<gx:Track>
    <when>2010-05-28T02:02:09Z</when>
    <when>2010-05-28T02:02:35Z</when>
    <when>2010-05-28T02:02:44Z</when>
    <when>2010-05-28T02:02:53Z</when>
    <when>2010-05-28T02:02:54Z</when>
    <when>2010-05-28T02:02:55Z</when>
    <when>2010-05-28T02:02:56Z</when>
    <gx:coord>-122.207881 37.371915 156.000000</gx:coord>
    <gx:coord>-122.205712 37.373288 152.000000</gx:coord>
    <gx:coord>-122.204678 37.373939 147.000000</gx:coord>
    <gx:coord>-122.203572 37.374630 142.199997</gx:coord>
    <gx:coord>-122.203451 37.374706 141.800003</gx:coord>
    <gx:coord>-122.203329 37.374780 141.199997</gx:coord>
    <gx:coord>-122.203207 37.374857 140.199997</gx:coord>
    <ExtendedData>
        <SchemaData schemaUrl="#schema">
            <gx:SimpleArrayData name="cadence">
                <gx:value>86</gx:value>
                <gx:value>103</gx:value>
                <gx:value>108</gx:value>
                <gx:value>113</gx:value>
                <gx:value>113</gx:value>
                <gx:value>113</gx:value>
                <gx:value>113</gx:value>
            </gx:SimpleArrayData>
            ...
        </SchemaData>
    </ExtendedData>
</gx:Track>
Jul 22, 2014 at 7:03 AM
I've not got an example, however, which part are you having difficulties with?

You should be able to set the ExtendedData property of the Track to a new instance of the ExtendedData class, which has the AddSchemaData method that you can add the SchemaData to. You may find it easier to create the KML going from the innermost element to the outer element, so in this case create the GX.SimpleArrayData first, then the SchemaData and then the ExtendedData.

If you post the code you've got that you're having problems with, along with any exceptions or output then I will try to help some more, but hope that gets you going in the right direction.

Sam
Jul 22, 2014 at 10:26 AM

Hi Sam,

I’m sorted – I was missing my Schema tag!

Many thanks for getting back to me so promptly!

Many thanks

Martin