AbstractViews

Camera

class simplekml.Camera(roll=None, **kwargs)

A virtual camera that views the scene.

The arguments are the same as the properties.

Basic Usage:

import simplekml
kml = simplekml.Kml()
pnt = kml.newpoint()
pnt.camera.latitude = 0.02
pnt.camera.longitude = 0.012
pnt.camera.altitude = 10000
pnt.camera.tilt = 45
pnt.camera.heading = 0
pnt.camera.roll = 0
pnt.camera.altitudemode = simplekml.AltitudeMode.relativetoground
kml.save("Camera.kml")

Assignment Usage:

import simplekml
kml = simplekml.Kml()
pnt = kml.newpoint()
camera = simplekml.Camera(latitude=0.0, longitude=0.0, altitude=0.0, roll=0, tilt=45,
                          altitudemode=simplekml.AltitudeMode.relativetoground)
pnt.camera = camera
kml.save("Camera Alternative.kml")
altitude

Height above the earth in meters (m), accepts int.

altitudemode

Specifies how the altitude for the Camera is interpreted.

Accepts simplekml.AltitudeMode constants.

gxaltitudemode

Specifies how the altitude for the Camera is interpreted.

With the addition of being relative to the sea floor. Accepts simplekml.GxAltitudeMode constants.

gxhorizfov

Rotation about the x axis, accepts float.

gxtimespan

Period of time, accepts simplekml.GxTimeSpan

gxtimestamp

Represents a single moment in time, accepts simplekml.GxTimeStamp

gxvieweroptions

Enables special viewing modes , accepts simplekml.GxViewerOptions

heading

Rotation about the z axis, accepts float.

latitude

Decimal degree value in WGS84 datum, accepts float.

longitude

Decimal degree value in WGS84 datum, accepts float.

roll

Rotation about the y axis, accepts float.

tilt

Rotation about the x axis, accepts float.

LookAt

class simplekml.LookAt(range=None, **kwargs)

Positions the camera in relation to the object that is being viewed.

The arguments are the same as the properties (most inherited from simplekml.AbstractView)

Usage:

import simplekml
kml = simplekml.Kml()
ls = kml.newlinestring(name='A LineString')
ls.coords = [(18.333868,-34.038274,10.0), (18.370618,-34.034421,10.0)]
ls.extrude = 1
ls.altitudemode = simplekml.AltitudeMode.relativetoground
ls.lookat.gxaltitudemode = simplekml.GxAltitudeMode.relativetoseafloor
ls.lookat.latitude = -34.028242
ls.lookat.longitude = 18.356852
ls.lookat.range = 3000
ls.lookat.heading = 56
ls.lookat.tilt = 78
kml.save("LookAt.kml")
altitude

Height above the earth in meters (m), accepts int.

altitudemode

Specifies how the altitude for the Camera is interpreted.

Accepts simplekml.AltitudeMode constants.

gxaltitudemode

Specifies how the altitude for the Camera is interpreted.

With the addition of being relative to the sea floor. Accepts simplekml.GxAltitudeMode constants.

gxhorizfov

Rotation about the x axis, accepts float.

gxtimespan

Period of time, accepts simplekml.GxTimeSpan

gxtimestamp

Represents a single moment in time, accepts simplekml.GxTimeStamp

gxvieweroptions

Enables special viewing modes , accepts simplekml.GxViewerOptions

heading

Rotation about the z axis, accepts float.

latitude

Decimal degree value in WGS84 datum, accepts float.

longitude

Decimal degree value in WGS84 datum, accepts float.

range

Distance in meters from the point, accepts int.

tilt

Rotation about the x axis, accepts float.

GxOption

class simplekml.GxOption(name=None, enabled=False)

Child element of simplekml.GxViewerOptions.

The arguments are the same as the properties.

enabled

Whether the effect must be turned on or off, boolean.

historicalimagery = 'historicalimagery'
name

Name of the effect being applied.

The following strings can be used simplekml.GxOption.streetview, simplekml.GxOption.historicalimagery or simplekml.GxOption.sunlight

streetview = 'streetview'
sunlight = 'sunlight'

GxViewerOptions

class simplekml.GxViewerOptions(gxoptions=None)

Enables special viewer modes.

The arguments are the same as the properties.

newgxoption(name, enabled=True)

Creates a simplekml.GxOption with name name and sets it to enabled.