Tour

GxAnimatedUpdate

class simplekml.GxAnimatedUpdate(gxduration=None, gxdelayedstart=None, update=None)

Controls changes during a tour to KML features.

The arguments are the same as the properties. See simplekml.GxTour for usage.

gxdelayedstart

Double of number of seconds to wait before starting.

gxduration

Double indicating how long the camera remains still.

id

The id string.

update

Instance of simplekml.Update

GxFlyTo

class simplekml.GxFlyTo(gxduration=None, gxflytomode=None, camera=None, lookat=None)

Allows unbroken flight from point to point.

The arguments are the same as the properties. See simplekml.GxTour for usage.

addfile(path)
bounce = 'bounce'
camera

Camera that views the scene, accepts simplekml.Camera

gxduration

Double indicating how long the camera remains still.

gxflytomode

How the camera behaves, accepts simplekml.GxFlyToMode constants.

id

The id string.

lookat

Camera relative to the feature, accepts simplekml.LookAt

smooth = 'smooth'

GxPlaylist

class simplekml.GxPlaylist(gxtourprimitives=None)

Defines a part of a tour.

The arguments are the same as the properties. See simplekml.GxTour for usage.

addgxtourprimitive(value)
newgxanimatedupdate(**kwargs)

Creates a new simplekml.GxAnimatedUpdate and adds it to the playlist.

Accepts the same agruments as simplekml.GxAnimatedUpdate and returns an instance of simplekml.GxAnimatedUpdate

newgxflyto(**kwargs)

Creates a new simplekml.GxFlyTo and adds it to the playlist.

Accepts the same agruments as simplekml.GxFlyTo and returns an instance of simplekml.GxFlyTo

newgxsoundcue(**kwargs)

Creates a new simplekml.GxSoundCue and adds it to the playlist.

Accepts the same agruments as simplekml.GxSoundCue and returns an instance of simplekml.GxSoundCue

newgxtourcontrol(**kwargs)

Creates a new simplekml.GxTourControl and adds it to the playlist.

Accepts the same agruments as simplekml.GxTourControl and returns an instance of simplekml.GxTourControl

newgxwait(**kwargs)

Creates a new simplekml.GxWait and adds it to the playlist.

Accepts the same agruments as simplekml.GxWait and returns an instance of simplekml.GxWait

GxSoundCue

class simplekml.GxSoundCue(href=None, gxdelayedstart=None)

Specifies a sound to be played in a tour.

The arguments are the same as the properties. See simplekml.GxTour for usage.

gxdelayedstart

Double telling the number of seconds to delay playing the file.

href

A string reference to a sound file to play.

id

The id string.

GxTour

class simplekml.GxTour(name=None, description=None, gxplaylists=None)

Defines a tour.

The arguments are the same as the properties.

Usage:

# Demonstrates touring with the reproduction of the tour sample in the KML Reference
# https://developers.google.com/kml/documentation/kmlreference#gxtour with the addition of GxSoundCue

import os
import simplekml

# Create an instance of kml
kml = simplekml.Kml(name="Tours", open=1)

# Create a new point and style it
pnt = kml.newpoint(name="New Zealand's Southern Alps", coords=[(170.144,-43.605)])
pnt.style.iconstyle.scale = 1.0

# Create a tour and attach a playlist to it
tour = kml.newgxtour(name="Play me!")
playlist = tour.newgxplaylist()

# Attach a gx:SoundCue to the playlist and delay playing by 2 second (sound clip is about 4 seconds long)
soundcue = playlist.newgxsoundcue()
soundcue.href = "http://simplekml.googlecode.com/hg/samples/resources/drum_roll_1.wav"
soundcue.gxdelayedstart = 2

# Attach a gx:AnimatedUpdate to the playlist
animatedupdate = playlist.newgxanimatedupdate(gxduration=6.5)
animatedupdate.update.change = '<IconStyle targetId="{0}"><scale>10.0</scale></IconStyle>'.format(pnt.style.iconstyle.id)

# Attach a gx:FlyTo to the playlist
flyto = playlist.newgxflyto(gxduration=4.1)
flyto.camera.longitude = 170.157
flyto.camera.latitude = -43.671
flyto.camera.altitude = 9700
flyto.camera.heading = -6.333
flyto.camera.tilt = 33.5
flyto.camera.roll = 0

# Attach a gx:Wait to the playlist to give the gx:AnimatedUpdate time to finish
wait = playlist.newgxwait(gxduration=2.4)

# Save to file
kml.save(os.path.splitext(__file__)[0] + ".kml")
description

String description of the tour.

name

String name of the tour

newgxplaylist(gxtourprimitives=None)

Adds a simplekml.GxPlaylist and returns it.

GxTourControl

class simplekml.GxTourControl(gxplaymode='pause')

Allows a tour to be paused.

The arguments are the same as the properties.

gxplaymode

String to pause the tour, accepts simplekml.GxPlayMode constants.

id

The id string.

Update

class simplekml.Update(targethref=None, change=None, create=None, delete=None)

Action to take when animation updates.

The arguments are the same as the properties. See simplekml.GxTour for usage.

change

KML string representing a change in animation.

create

KML string representing a creation during animation.

delete

KML string representing a deletion during animation.

targethref

The target url.

GxWait

class simplekml.GxWait(gxduration=None)

Allows a tour to be paused.

The arguments are the same as the properties. See simplekml.GxTour for usage.

gxduration

Double indicating how long the camera remains still.

id

The id string.