Containers

Document

class simplekml.Document(**kwargs)

A container for features and styles.

Arguments are the same as the properties.

Usage:

import simplekml
kml = simplekml.Kml()
doc = kml.newdocument(name='A Document')
pnt = doc.newpoint()
kml.save("Document.kml")
address

Standard address, accepts string.

allcontainers

Returns a list of all the containers that have been attached to this container, and all sub containers.

New in version 1.1.0

allfeatures

Returns a list of all the features that have been attached to this container, and all sub features.

New in version 1.1.0

allgeometries

Returns a list of all the geometries that have been attached to this container, and all sub geometries.

New in version 1.1.0

allstylemaps

Returns a list of all the stylemaps that have been attached to this container, and all sub stylemaps.

New in version 1.1.0

allstyles

Returns a list of all the styles that have been attached to this container, and all sub styles.

New in version 1.1.0

atomauthor

Author of the feature, accepts string.

URL containing this KML, accepts string.

balloonstyle

BalloonStyle of the feature, accepts simplekml.BalloonStyle

camera

Camera that views the scene, accepts simplekml.Camera

containers

Returns a list of all the containers that have been attached to this container.

New in version 1.1.0

description

Description shown in the information balloon, accepts string.

extendeddata

Extra data for the feature.

features

Returns a list of all the features that have been attached to this container.

New in version 1.1.0

geometries

Returns a list of all the geometries that have been attached to this container.

New in version 1.1.0

gxballoonvisibility

Toggles visibility of a description balloon, accepts int 0 or 1

New in version 1.1.1

iconstyle

IconStyle of the feature, accepts simplekml.IconStyle

id

Id number of feature, read-only.

labelstyle

LabelStyle of the feature, accepts simplekml.LabelStyle

linestyle

LineStyle of the feature, accepts simplekml.LineStyle

liststyle

ListStyle of the feature, accepts simplekml.ListStyle

lookat

Camera relative to the feature, accepts simplekml.LookAt

name

Name of placemark, accepts string.

newdocument(**kwargs)

Creates a new simplekml.Folder and attaches it to this KML document.

Arguments are the same as simplekml.Folder

Returns:
newfolder(**kwargs)

Creates a new simplekml.Folder and attaches it to this KML document.

Arguments are the same as simplekml.Folder

Returns:
newgroundoverlay(**kwargs)

Creates a new simplekml.GroundOverlay and attaches it to this KML document.

Arguments are the same as simplekml.GroundOverlay

Returns:
newgxmultitrack(**kwargs)

Creates a new simplekml.GxMultiTrack and attaches it to this KML document.

Arguments are the same as simplekml.GxMultiTrack

Returns:
newgxtour(**kwargs)

Creates a new simplekml.GxTour and attaches it to this KML document.

Arguments are the same as simplekml.GxTour

Returns:
newgxtrack(**kwargs)

Creates a new simplekml.GxTrack and attaches it to this KML document.

Arguments are the same as simplekml.GxTrack

Returns:
newlinestring(**kwargs)

Creates a new simplekml.LineString and attaches it to this KML document.

Arguments are the same as simplekml.LineString

Returns:
newmodel(**kwargs)

Creates a new simplekml.Model and attaches it to this KML document.

Arguments are the same as simplekml.Model

Returns:
newmultigeometry(**kwargs)

Creates a new simplekml.MultiGeometry and attaches it to this KML document.

Arguments are the same as simplekml.MultiGeometry

Returns:

Creates a new simplekml.NetworkLink and attaches it to this KML document.

Arguments are the same as simplekml.NetworkLink

Returns:
newphotooverlay(**kwargs)

Creates a new simplekml.PhotoOverlay and attaches it to this KML document.

Arguments are the same as simplekml.PhotoOverlay

Returns:
newplacemark(**kwargs)

Creates a new simplekml.Placemark and attaches it to this KML document.

Arguments are the same as simplekml.Placemark

Returns:
  • an instance of simplekml.Placemark class.
newpoint(**kwargs)

Creates a new simplekml.Point and attaches it to this KML document.

Arguments are the same as simplekml.Point

Returns:
newpolygon(**kwargs)

Creates a new simplekml.Polygon and attaches it to this KML document.

Arguments are the same as simplekml.Polygon

Returns:
newschema(**kwargs)

Creates a new simplekml.Schema and attaches it to this KML document.

Arguments are the same as simplekml.Schema

Returns:
newscreenoverlay(**kwargs)

Creates a new simplekml.ScreenOverlay and attaches it to this KML document.

Arguments are the same as simplekml.ScreenOverlay

Returns:
open

Whether open or closed in Places panel, accepts int 0 or 1.

phonenumber

Phone number used by Google Maps mobile, accepts string.

polystyle

PolyStyle of the feature, accepts simplekml.PolyStyle

region

Bounding box of feature, accepts simplekml.Region

snippet

Short description of the feature, accepts simplekml.Snippet

style

The current style of the feature, accepts simplekml.Style

stylemap

The current StyleMap of the feature, accepts simplekml.StyleMap

stylemaps

Returns a list of all the stylemaps that have been attached to this container.

New in version 1.1.0

styles

Returns a list of all the styles that have been attached to this container.

New in version 1.1.0

styleurl

Reference to the current styleurl or the feature, accepts string.

timespan

Period of time, accepts simplekml.TimeSpan

timestamp

Single moment in time, accepts simplekml.TimeStamp

visibility

Whether the feature is shown, accepts int 0 or 1.

xaladdressdetails

Address in xAL format, accepts string.

Note

There seems to be a bug in Google Earth where the inclusion of the namespace xmlns:xal=”urn:oasis:names:tc:ciq:xsdschema:xAL:2.0” seems to break some other elements of the KML such as touring (a tour will not play). If xaladdressdetails is used the above namespace will be added to the KML and will possibly break other elements. Use with caution.

Folder

class simplekml.Folder(**kwargs)

A container for features that act like a folder.

Arguments are the same as the properties.

Usage:

import simplekml
kml = simplekml.Kml()
fol = kml.newfolder(name='A Folder')
pnt = fol.newpoint()
kml.save("Folder.kml")
address

Standard address, accepts string.

allcontainers

Returns a list of all the containers that have been attached to this container, and all sub containers.

New in version 1.1.0

allfeatures

Returns a list of all the features that have been attached to this container, and all sub features.

New in version 1.1.0

allgeometries

Returns a list of all the geometries that have been attached to this container, and all sub geometries.

New in version 1.1.0

allstylemaps

Returns a list of all the stylemaps that have been attached to this container, and all sub stylemaps.

New in version 1.1.0

allstyles

Returns a list of all the styles that have been attached to this container, and all sub styles.

New in version 1.1.0

atomauthor

Author of the feature, accepts string.

URL containing this KML, accepts string.

balloonstyle

BalloonStyle of the feature, accepts simplekml.BalloonStyle

camera

Camera that views the scene, accepts simplekml.Camera

containers

Returns a list of all the containers that have been attached to this container.

New in version 1.1.0

description

Description shown in the information balloon, accepts string.

extendeddata

Extra data for the feature.

features

Returns a list of all the features that have been attached to this container.

New in version 1.1.0

geometries

Returns a list of all the geometries that have been attached to this container.

New in version 1.1.0

gxballoonvisibility

Toggles visibility of a description balloon, accepts int 0 or 1

New in version 1.1.1

iconstyle

IconStyle of the feature, accepts simplekml.IconStyle

id

Id number of feature, read-only.

labelstyle

LabelStyle of the feature, accepts simplekml.LabelStyle

linestyle

LineStyle of the feature, accepts simplekml.LineStyle

liststyle

ListStyle of the feature, accepts simplekml.ListStyle

lookat

Camera relative to the feature, accepts simplekml.LookAt

name

Name of placemark, accepts string.

newdocument(**kwargs)

Creates a new simplekml.Folder and attaches it to this KML document.

Arguments are the same as simplekml.Folder

Returns:
newfolder(**kwargs)

Creates a new simplekml.Folder and attaches it to this KML document.

Arguments are the same as simplekml.Folder

Returns:
newgroundoverlay(**kwargs)

Creates a new simplekml.GroundOverlay and attaches it to this KML document.

Arguments are the same as simplekml.GroundOverlay

Returns:
newgxmultitrack(**kwargs)

Creates a new simplekml.GxMultiTrack and attaches it to this KML document.

Arguments are the same as simplekml.GxMultiTrack

Returns:
newgxtour(**kwargs)

Creates a new simplekml.GxTour and attaches it to this KML document.

Arguments are the same as simplekml.GxTour

Returns:
newgxtrack(**kwargs)

Creates a new simplekml.GxTrack and attaches it to this KML document.

Arguments are the same as simplekml.GxTrack

Returns:
newlinestring(**kwargs)

Creates a new simplekml.LineString and attaches it to this KML document.

Arguments are the same as simplekml.LineString

Returns:
newmodel(**kwargs)

Creates a new simplekml.Model and attaches it to this KML document.

Arguments are the same as simplekml.Model

Returns:
newmultigeometry(**kwargs)

Creates a new simplekml.MultiGeometry and attaches it to this KML document.

Arguments are the same as simplekml.MultiGeometry

Returns:

Creates a new simplekml.NetworkLink and attaches it to this KML document.

Arguments are the same as simplekml.NetworkLink

Returns:
newphotooverlay(**kwargs)

Creates a new simplekml.PhotoOverlay and attaches it to this KML document.

Arguments are the same as simplekml.PhotoOverlay

Returns:
newplacemark(**kwargs)

Creates a new simplekml.Placemark and attaches it to this KML document.

Arguments are the same as simplekml.Placemark

Returns:
  • an instance of simplekml.Placemark class.
newpoint(**kwargs)

Creates a new simplekml.Point and attaches it to this KML document.

Arguments are the same as simplekml.Point

Returns:
newpolygon(**kwargs)

Creates a new simplekml.Polygon and attaches it to this KML document.

Arguments are the same as simplekml.Polygon

Returns:
newscreenoverlay(**kwargs)

Creates a new simplekml.ScreenOverlay and attaches it to this KML document.

Arguments are the same as simplekml.ScreenOverlay

Returns:
open

Whether open or closed in Places panel, accepts int 0 or 1.

phonenumber

Phone number used by Google Maps mobile, accepts string.

polystyle

PolyStyle of the feature, accepts simplekml.PolyStyle

region

Bounding box of feature, accepts simplekml.Region

snippet

Short description of the feature, accepts simplekml.Snippet

style

The current style of the feature, accepts simplekml.Style

stylemap

The current StyleMap of the feature, accepts simplekml.StyleMap

stylemaps

Returns a list of all the stylemaps that have been attached to this container.

New in version 1.1.0

styles

Returns a list of all the styles that have been attached to this container.

New in version 1.1.0

styleurl

Reference to the current styleurl or the feature, accepts string.

timespan

Period of time, accepts simplekml.TimeSpan

timestamp

Single moment in time, accepts simplekml.TimeStamp

visibility

Whether the feature is shown, accepts int 0 or 1.

xaladdressdetails

Address in xAL format, accepts string.

Note

There seems to be a bug in Google Earth where the inclusion of the namespace xmlns:xal=”urn:oasis:names:tc:ciq:xsdschema:xAL:2.0” seems to break some other elements of the KML such as touring (a tour will not play). If xaladdressdetails is used the above namespace will be added to the KML and will possibly break other elements. Use with caution.