Possible to show all placemarks with Timestamps in Google Earth by default?
Asked Answered
G

1

6

I'm looking at creating KML placemarks with Timestamp elements. This itself is fairly easy to do, but I don't like the behavior of Google Earth only showing a small band of time when the KML is initially loaded. I'd like it to show the full span of time (and thus all the placemarks) by default.

Is there any way to do this? I'm not seeing any settings in Google Earth, or anything in the KML documentation for this.

An alternative I'm considering is to basically duplicate each placemark, and have 1 set with Timestamps, and 1 without, in separate folders. The folders would use the radio-button selection feature. I'd like to avoid this if possible, as a KML could potentially have thousands of placemarks, and seems to be a waste to duplicate the nodes.

Here's an example from this source that has KML with placemarks if you'd like to see the behavior I'm speaking of.

Update: The behavior I'm seeing with the time slider not defaulting to the full span of the contained KML placemarks seems to be because the file is loaded via a Network Link to a local file. I'm not sure how to control the behavior of the time slider in this case. I can have the link do a "fly to view on refresh", which sets the time slider correctly, but I don't want to move the camera to a lat/long, as I am refreshing every 4 seconds.

Glassful answered 17/9, 2012 at 12:18 Comment(0)
H
7

By default Google Earth shows the full time of the KML. However, a common situation is when multiple KML files are opened/visible with times where Google Earth by default shows the full time range of earliest and latest times in all KML features. Also, loading KML via NetworkLinks does not show the full time range as does opening it directly in Google Earth.

To illustrate first uncheck your saved places to disable other KML with times then load this KML file. You'll notice the timeline showing 1787 through 1959 for its full range. https://developers.google.com/kml/documentation/us_states.kml

If you wanted to pre-define a time range you can explicitly add a Camera or LookAt that constraints the time view. For example to constrain the view to the first 100 years you could add a <gx:TimeSpan> element with a year range to the root-level element in your KML. Remember to include the lat/lon/range elements otherwise the view will default to lat=0, lon=0, range=0.

<?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>
    ....
    <LookAt>
            <gx:TimeSpan>
                    <begin>1787</begin>
                    <end>1887</end>
            </gx:TimeSpan>
            <longitude>-95.71</longitude>
            <latitude>37.09</latitude>
            <range>4119625</range>
            ...
    </LookAt>
    ...
</Document>
</kml>

If you right-mouse click on a Placemark or Folder then select 'Snapshot View' in Google Earth and the timer slider is visible then the time range will be captured in the saved view.

So you can do what you want without duplicating the placemarks with times but by creating a few placemarks only defined with a view constrained by time range. Clicking each of these special placemarks would change the time slider to whatever time range you want to show.

KML features with times retrieved via Networklinks have a different behavior and only a portion of the time range is pre-selected in the time slider. You must add flyToView to the NetworkLink for it to behave same as loading the KML directly.

<NetworkLink>
  <flyToView>1</flyToView>
  <Link>
    <href>...</href>
  </Link>
</NetworkLink>

As a best practice if you include more than one NetworkLink with time-based features in a parent KML file then add a <TimeSpan> element to the NetworkLinks including the full range of time for that collection of features otherwise Google Earth will automatically load the entire file at startup.

<NetworkLink>
  <TimeSpan>
    <begin>1787</begin>
    <end>1887</end>
  </TimeSpan>
  <flyToView>1</flyToView>
  <Link>
    <href>...</href>
  </Link>
</NetworkLink>

References:
https://developers.google.com/kml/documentation/kmlreference#timespan
https://developers.google.com/kml/documentation/kmlreference#gxtimespan

Hassi answered 25/9, 2012 at 14:3 Comment(6)
I just loaded the US States KML you linked in, in a clean Google Earth without any enabled saved places. I didn't think I had any saved places of interest on the other machien I tried this on. Could you please explain: "Google Earth by default shows the full time range of earliest and latest times in all KML features." Are you talking timespans, rather than time stamps?Glassful
Also, as noted in my OP, I used TimeStamp nodes. The US States example you linked me to use TimeSpan, with just a Begin element. Perhaps that is the key to get GE to display all elements by default, but might be related to other kmls loaded as well.Glassful
oh, I think what you're saying is, if you have file A from 1910 - 1920, and file b from 1940 - 1950, then you're saying google earth woudl default to 1910 - 1950. This isn't quite what I was seeing though, as it seemed like it was just displaying the first 10% of the time span, I think. Not in front of that machine right now to see.Glassful
You got it right - if you have one KML with times from 1910 to 1920 and another from 1940 - 1950 then GE at least 6.2.2 running from Windows it shows the full range 1910 - 1950. If you double click on a given KML then it will shorten the time range to the range of that file, which can be overridden as I described. Also, doesn't matter about TimeSpan or TimeStamp - TimeStamp basically treated as span with same start and end time.Hassi
I think my difference in behavior is becuase i'm loading the files from network links. see my update in my OP.Glassful
You're right. If you load the URLs via NetworkLink it only shows a portion of the time. Loading URL directly shows the entire time range. Inconsistent behavior. This is a bug. See code.google.com/p/earth-issues/issues/detail?id=1466 If, however, you add gx:timeSpan to NetworkLink then you get the full time range... Don't forget the gx: namespace declaration.Hassi

© 2022 - 2024 — McMap. All rights reserved.