[Tutorial] how to make animated Google Earth models
-
This is tutorial about making animated Google Earth Models (kmz) like this one. There are different approaches, I will show how to use the animatedUpdate. For more info, please go to the KML-Reference on Google Code. There are also good tutorials. Unfortunately, these edited/animated kmz-files can not be included on the 3d-layer.
1. (basic) KMZ-files are zip-compressed. If you open them with a zip-Program (like 7zip), you find a kml-file and a "model" folder which contains the model in Collada file format (.dae). The kml-file contains all geo-related data that we want to edit in a text editor.
2. The content of the kml-file describes what you see in the left sidebar when you open the model in Google Earth. A folder with checkbox, the model, and eventually a tour or other content. Then the balloon tips with info when you click on an item.
Important is this <Placemark> element:<Placemark> <Model> <altitudeMode>relativeToGround</altitudeMode> <Location> <longitude>55.284450029723</longitude> <latitude>25.220200235564</latitude> <altitude>0.000000000000</altitude> </Location> <Orientation id="01"> <heading>-0.000000000000</heading> <tilt>0</tilt> <roll>0</roll> </Orientation> <Scale> <x>1.0</x> <y>1.0</y> <z>1.0</z> </Scale> <Link> <href>models/model.dae</href> </Link> </Model> </Placemark>
You see, the only reference to the model file is in the <link> element. So if you replace the collada model file, you only have to replace this reference to the model.
3. If you want to have several objects that move independently, you need one model file for each. That means you have to export each layer or group separately as Collada (.dae) and merge them again. Copy the .dae file and its accompanying image folder into the model folder inside the kmz. (If you need to replace texture file names due to name collision, don't forget to search and replace them in the collada file).
In the kml-file, you can duplicate the <Placemark> code of the previous model as it is and replace the reference of the new model file.4. For making a tour in your kmz, you need to add the following code at the end of the kml-file before the </kml> tag:
<gx;Tour> <name>Play me!</name> <gx;Playlist> ... </gx;Playlist> </gx;Tour>
The tour can contain different placemarks all around the world and other features from the KML-Reference. We want to use only the gx:AnimatedUpdate to change properties of the models. The property will be changed in a smooth way for the given duration (in seconds).
<gx;AnimatedUpdate> <gx;duration>3</gx;duration> <Update> <targetHref></targetHref> <Change> <Orientation targetId="01"> <heading>119</heading> </Orientation> </Change> </Update> </gx;AnimatedUpdate>
In this example, I added an id to the <orientation> element in the code above. So now I am able to reference to this id with targetId and make changes to the orientation. This example will make the model rotate about 119 degrees.
In the same way, it is possible to move objects by changing the location, or to scale them. You can also turn models on or off by changing <visibility> (1=visible, 0=hidden, see KML-Reference).
The id must be unique for each element that you want to change.5. If you want to have several sequenced animations, you have to say Google Earth to wait until the previous animatedUpdate has finished:
<gx;Wait> <gx;duration>3</gx;duration> </gx;Wait>
Otherwise it will continue with the next animation immediately.
Note: There are other possible approaches for animations:
The old way (like "key frames") is to make a series of Placemarks for each incremental movement of the model and to display that Placemark for ie. 0.1 seconds. That way you require many lines of code and the animation does not look smooth.
Another possibility is to use the time slider in Google Earth. You can asign a gx:TimeSpan to each placemark with one model from ie. 1750 to 1910 and another model from 1820 to 1940. Then the models will only be visible in their particular epoque. -
This is a fantastic tutorial, thank you so much for sharing.
I have a model of a historic town and this looks like a great way to animate change over time.
I have only begun to poke around in the kmz format-- do you know what the limits of the file size are? My models are often larger than simple photo textured GE models, I wondered what the limits might be.
Thanks again for sharing, this will take awhile for me to digest.
-
If you have many buildings I would leave them as single kmz files and use the timespan. I have not tried, but I think after loading all files into Google Earth, it should be possible to control all at once with the time slider.
-
Hi Aerilius,
Thanks for the little insight (and indeed it is "babysteps")
Now as for the rotation example for instance; what would define the axis of rotation in the file? Is it "simply" the geometric centre? And what axis? Is it automatically the vertical axis?
-
Many thanks for the comments!
"heading" is the rotation around the vertical axis (for example in south or east direction). Tilt and roll are around horizontal axis (I have not yet tried which), they are mostly used for camera orientation: tilt = up or down, roll = around the center of your screen (like if you do a headstand).
And the model origin point must be in the rotation center (move the model to the origin, simply moving the axis does not change the model origin).
-
OK, thanks - it sounds logical.
-
Hi Aerilius,
Hi Sketch Enthusiasts!I have a vision to make 3d models of Public transport in my city (buses) and via KMZ (or by another way) define movement of theese models inside Google Earth in real time depending on real time tables.
I am not good in KML/KMZ so i will be very delighted if somebody can help...Many Thanks,
P a v e l V a n í č e k
3d models for Google Earth
http://www.pavelvanicek.cz
pavelvan@gmail.com -
Hi
Have unzipped a .kmz file and have a files folder and doc.kmlamended .kml file and saved
How do I save it back as a model file?
tried zipping it back and renaming file xxx.kmz but get Parse error at line 1, column 2 not well formed (invalid token) when I open it in GE
Have tried it without amending the .kml file but still get the same error.
Advertisement