Time span and Animation of polygon

941 views
Skip to first unread message

chao shen

unread,
May 20, 2011, 7:06:46 PM5/20/11
to kml-support-g...@googlegroups.com
I tried to changing a polygon's shape and moving it to different positions at same time. I used

  <gx:Tour>    <gx:Playlist>  <gx:AnimatedUpdate>...
And it works pretty well.

But I want to the make the change in a time interval. For example, I want to have it from 9:00am to 9:10am. It seems I need to use time span.  But when I use it, the google earth did not change the polygon's shape or position for me.

Could anyone give me a example of how to do it?

Thanks a lot.


SeanA

unread,
May 26, 2011, 5:50:01 PM5/26/11
to KML Developer Support - Getting Started with KML
Hi there chao,

It's not entirely clear to me what you would like to do, but I'll try
explaining a few things in case it helps.

KML Tours allow you to interpolate between KML values (like
coordinates). This is what enabled you to morph one polygon into
another. At the moment, you can only do these kinds of animations
within a Tour.

When you use <TimeStamp> and <TimeSpan> in a regular KML (not in a
Tour), it will only affect the visibility of the placemark you put it
on, according to the current position of the time slider. TimeStamps
and TimeSpans won't animate your polygons like a tour will... it will
just turn one on and another off.

This code sample (you can paste directly into Google Earth) will have
one placemark visible at 0,0 from 09:00:00-09:09:59, and the other
placemark at 1,1 visible from 09:10:00-09:19:59.

<Document>
<Placemark id="foo">
<TimeSpan>
<begin>2000-01-01T09:00:00</begin>
<end>2000-01-01T09:09:59</end>
</TimeSpan>
<Point>
<coordinates>0,0</coordinates>
</Point>
</Placemark>
<Placemark id="bar">
<TimeSpan>
<begin>2000-01-01T09:10:00</begin>
<end>2000-01-01T09:19:59</end>
</TimeSpan>
<Point>
<coordinates>1,1</coordinates>
</Point>
</Placemark>
</Document>


However, if you want to animate a single placemark to move from 0,0 to
1,1 over an amount of time, you would make a Tour:

<?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">
<Document>
<LookAt>
<longitude>0</longitude>
<latitude>0</latitude>
<range>1141992.820263111</range>
<altitudeMode>relativeToGround</altitudeMode>
</LookAt>
<gx:Tour>
<gx:Playlist>
<gx:AnimatedUpdate>
<gx:duration>2</gx:duration>
<Update>
<targetHref/>
<Change>
<Point targetId="foo_coords">
<coordinates>1,1</coordinates>
</Point>
</Change>
</Update>
</gx:AnimatedUpdate>
<gx:Wait>
<gx:duration>3</gx:duration>
</gx:Wait>
</gx:Playlist>
</gx:Tour>
<Placemark>
<Point id="foo_coords">
<coordinates>0,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>


Now, if you want to morph one geometry into another AND change the
time slider, you can do that too, by adding TimeStamps/Spans to the
Tour. But the time alone isn't enough to morph the geometry:

In this example, notice that as the point placemark moves, the time
slider also moves, because we are using a <gx:FlyTo> to move the
camera and the position. And at the very end of the 2 second
animation, we the placemark disappears. That's because the FlyTo flies
to 9:22am, and the placemark itself is only visible in the
9:10am-9:19:59am timespan.

<?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">
<Document>
<LookAt>
<range>1141992.820263111</range>
<altitudeMode>relativeToGround</altitudeMode>
</LookAt>
<gx:Tour>
<gx:Playlist>
<gx:FlyTo>
<LookAt>
<gx:TimeStamp>
<when>2000-01-01T09:10:00</when>
</gx:TimeStamp>
<longitude>0</longitude>
<latitude>0</latitude>
<range>1141992.820263111</range>
<altitudeMode>relativeToGround</altitudeMode>
</LookAt>
</gx:FlyTo>
<gx:AnimatedUpdate>
<gx:duration>2</gx:duration>
<Update>
<targetHref/>
<Change>
<Point targetId="foo_coords">
<coordinates>1,1</coordinates>
</Point>
</Change>
</Update>
</gx:AnimatedUpdate>
<gx:FlyTo>
<gx:duration>2</gx:duration>
<LookAt>
<gx:TimeStamp>
<when>2000-01-01T09:22:00</when>
</gx:TimeStamp>
<longitude>0</longitude>
<latitude>0</latitude>
<range>1141992.820263111</range>
<altitudeMode>relativeToGround</altitudeMode>
</LookAt>
</gx:FlyTo>
</gx:Playlist>
</gx:Tour>
<Placemark>
<gx:TimeSpan>
<begin>2000-01-01T09:10:00</begin>
<end>2000-01-01T09:19:59</end>
</gx:TimeSpan>
<Point id="foo_coords">
<coordinates>0,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>


Does any of this help?

The Tour can animate the placemark/polygon using gx:AnimateUpdate and
the gx:FlyTo can move the camera and adjust the time slider. But
TimeStamp or TimeSpans alone cannot morph/animate things.

SeanA
Reply all
Reply to author
Forward
0 new messages