Module kml
Tools used in the creation of a kml file from a station database. These
functions are used in the script stdb_to_kml.py
. In a terminal,
type stdb_to_kml.py -h
for help on usage.
- stdb.kml.createKML(nets=[], netd={}, fileName='stdb.kml', opts=None)[source]
Initializes and creates the kml document.
- Parameters:
nets (List) – List of networks
netd (Dict) – Dictionary of network elements
filename (str) – File name for output .kml file
opts – Options read from command line
- stdb.kml.createFolder(kmlDoc, net, stlist, netcolour, opts)[source]
For a kmlDocument and a dictionary of stations for a given network, make a folder element for this network, then create a placemark for every station.
- Parameters:
kmldoc – Object
net (str) – Name of network
stlist (List) – List of station names
netcolour (str) – RGB colour for network code
opts – Options read from command line
- Returns:
folderElement – Instance of
Folder
- Return type:
Folder
- stdb.kml.createPlacemark(kmlDoc, stdata=None, netcolor='ffffffff', opts=None)[source]
Creates a placemark in kmlDoc for a given row of a dictionary
- Parameters:
kmldoc – Object
stdata (Dict) – Dictionary of station metadata
netcolour (str) – RGB colour for network code
opts – Options read from command line
- Returns:
placemarkElement – Instance of
Folder
- Return type:
Folder
- stdb.kml.createStyleState(kmlDoc, scale, idtag)[source]
Used to create a doucment wide style state with the LabelStyle internal field scale. Sets the Labelstyle scale field to value “scale” and names the field “idtag”
- stdb.kml.createPair(kmlDoc, mode, state)[source]
Used to create a single Pair environment that has a particular mode and state
- stdb.kml.createStyleMap(kmlDoc)[source]
Creates a StyleMap environment called on-offText which enables label text for Placemarks on mouseover only.
- stdb.kml.createStyle(kmlDoc, netcolor, size, labtype='net', op=0)[source]
Creates a Style Environment with a variable size and colour. The last argument selects between two different icon types.