Keep UI Elements Open in Google Earth after kml file is refreshed (NetworkLink)

11 Views Asked by At

I would like to keep the UI elements that the user opens open even when the kml file is updated by the NetworkLink. e.g. when the user clicks on an area of the track the typical google earth popup opens with the metadata for that point of the track.

Unfortunately, it closes again as soon as the kml file is updated in the background. The coordinates and metadata in the actual kml file are updated via a python script.

This means that new tags with the time and new <gx:coord> tags with the coordinates and new <gx:value> tags with the metadata are added periodically.

The kml file that is actually opened only contains the link to the file that is being updated. this should remain the same and only the kml file that is supplemented with python should be changed.

This is what the kml file that changes periodically looks like:

<?xml version='1.0' encoding='us-ascii'?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
    <Document id="1">
        <name>Tracks</name>
        <open>1</open>
        <Document id="2">
            <name>PMX Track</name>
            <LookAt>
                <longitude>6.939013</longitude>
                <latitude>51.402926</latitude>
                <gx:TimeSpan id="4">
                    <begin>2024-03-25T09:56:28Z</begin>
                    <end>2024-03-25T10:56:28Z</end>
                </gx:TimeSpan>
                <range>1300.0</range>
            </LookAt>
            <Snippet>2024-03-25T09:56:28Z</Snippet>
            <Folder id="5">
                <Style id="14">
                    <IconStyle id="15">
                        <colorMode>normal</colorMode>
                        <scale>1</scale>
                        <heading>0</heading>
                        <Icon id="16">
                            <href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href>
                        </Icon>
                    </IconStyle>
                    <LineStyle id="17">
                        <color>99ffac59</color>
                        <colorMode>normal</colorMode>
                        <width>6</width>
                    </LineStyle>
                </Style>
                <Style id="18">
                    <IconStyle id="19">
                        <colorMode>normal</colorMode>
                        <scale>1.2</scale>
                        <heading>0</heading>
                        <Icon id="20">
                            <href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href>
                        </Icon>
                    </IconStyle>
                    <LineStyle id="21">
                        <color>99ffac59</color>
                        <colorMode>normal</colorMode>
                        <width>8</width>
                    </LineStyle>
                </Style>
                <StyleMap id="13">
                    <Pair>
                        <key>normal</key>
                        <styleUrl>#14</styleUrl>
                    </Pair>
                    <Pair>
                        <key>highlight</key>
                        <styleUrl>#18</styleUrl>
                    </Pair>
                </StyleMap>
                <name>Track</name>
                <Placemark id="9">
                    <name>2024-03-25T09:56:28Z</name>
                    <styleUrl>#13</styleUrl>
                    <gx:Track>
                        <when>2024-03-25T09:56:28Z</when>
                        <when>2024-03-25T09:56:30Z</when>
                        <when>2024-03-25T09:56:32Z</when>
                        <when>2024-03-25T09:56:34Z</when>
                        <gx:coord>6.939013 51.402926 175.089767</gx:coord>
                        <gx:coord>6.938377 51.402752 177.091431</gx:coord>
                        <gx:coord>6.937731 51.402578 179.461655</gx:coord>
                        <gx:coord>6.93708 51.402406 182.487854</gx:coord>
                        <altitudeMode>relativeToGround</altitudeMode>
                        <ExtendedData>
                            <SchemaData schemaUrl="#6">
                                <gx:SimpleArrayData name="heading">
                                    <gx:value>246.304316</gx:value>
                                    <gx:value>246.631439</gx:value>
                                    <gx:value>247.066691</gx:value>
                                    <gx:value>247.362823</gx:value>
                                    <gx:value>7777.77</gx:value>
                                </gx:SimpleArrayData>
                            </SchemaData>
                        </ExtendedData>
                    </gx:Track>
                </Placemark>
            </Folder>
        </Document>
        <Schema id="6">
            <gx:SimpleArrayField type="float" name="heading">
                <displayName>heading</displayName>
            </gx:SimpleArrayField>
        </Schema>
    </Document>
</kml>

This is what the networklink file 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" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
  <NetworkLink>
    <name>Test</name>
    <visibility>1</visibility>
    <Link>
      <href>gpsdata.kml</href>
      <refreshMode>onInterval</refreshMode>
      <refreshInterval>1</refreshInterval>
    </Link>
  </NetworkLink>
</kml>
0

There are 0 best solutions below