addFolder: Add Return and Remove Folder to and from KML file Structure

addFolder, getFolder, removeFolderR Documentation

Add Return and Remove Folder to and from KML file Structure

Description

Manipulate the directory structure for your kml. Folders can be created within other folders. Folders must have unique fid within the same directory.

Usage

yourKMLobj$addFolder(fid, name, silent, visibility, open, atomauthor, atomlinkhref, address, xalAddressDetails, phoneNumber, Snippet, description, AbstractView, TimeStamp, TimeSpanStart, TimeSpanEnd, styleUrl, Region, ExtendedData)
yourKMLobj$getFolder(fid)
yourKMLobj$removeFolder(fid)

Arguments

fid

Mandatory. Define the id for this folder. The id will be used to specify where features are added in the file structure.

name

Character string or NULL. This is the text that will be displayed in the file tree. (Default = NULL)

silent

TRUE if you do not wish to see messages, False if you would like folder opperations to be displayed. (Default = TRUE)

visibility

Boolean (0-invisible or 1-visible). Specify if the features contained by this folder are visible. (Default = 1)

open

Boolean (0-closed or 1-open). Specify if the folder is open or closed in the kml object tree. (Default = 0)

atomauthor

Character string or NULL. Text identifying an author relevant to the topic. See Ascription Elements under References (Default = NULL)

atomlinkhref

Character string or NULL. Text identifying a web link relevant to the topic. See Ascription Elements under References (Default = NULL)

address

Character string or NULL. Specify an unstructured address that is associated with the folder. (Default = NULL)

xalAddressDetails

Character string or NULL. Specify a structured address in eXtensible Address Language(See xal:AddressDetails under References) that is associated with the folder. (Default = NULL)

phoneNumber

Character string or NULL. Text identifying a phone number, useful for mobile apps. (Default = NULL)

Snippet

Character string or NULL. Supply details in addition to description. (Default = NULL)

description

Character string or NULL. Supply details, may contain CDATA. See NOTES section for more info. (Default = NULL)

AbstractView

Character string or NULL. The id of the desired AbstractView. Must create AbstractView with addAbstractView() function. (Default = NULL)

TimeStamp

Character string of date-time in one of the following formats: (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss). Used to create kml timeseries. (Default = NULL)

TimeSpanStart

Character string of date-time in one of the following formats(overrides TimeStamp): (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss). Used to create timeseries. (Default = NULL)

TimeSpanEnd

Character string of date-time in one of the following formats(overrides TimeStamp): (YYYY)(YYYY-MM)(YYYY-MM-DD)(YYYY-MM-DDThh:mm:ssZ)(YYYY-MM-DDThh:mm:ss). Used to create timeseries. (Default = NULL)

styleUrl

Character string or NULL. The id of the desired Style. Must create a style with one of the addStyle() or interactiveStyle() functions. (Default = NULL)

Region

Currently not supported

ExtendedData

Currently not supported

Note

description
For advanced description arguments, wrap html in CDATA tags. You can use packages to build html such as R2HTML(uses headers that are not required by CDATA) or, if you are comfortable with html, just add your html text inside CDATA enclosures.
text = ''<!\[CDATA\[
<b><font color="#CC0000" size='+3'>Example Text</font></b>
<br/><br/>
<font face='Courier'>Example Text</font>
]]>''

See also: Description Example

Author(s)

Brent Cameron
Department of Fisheries and Oceans Canada
Population Ecology Division

References

KML Folder Reference
Ascription Elements
xal:AddressDetails Details

Examples


mykml = RKmlObject()

mykml$addFolder(fid = "2013", name = "2013") #Demonstrate adding folder
mykml$getFolder("2013")$addFolder(fid = "survey_data", name = "survey data") #Demonstrate adding nested folder

##Demonstrate variable assignment of folder object##
sur2013 = mykml$getFolder("2013")$getFolder("survey_data") 
sur2013$addFolder(fid = "harbour")

mykml$getFolder("2013")$removeFolder("survey_data") #Demonstrate remove folder
mykml$getFolder("2013")$addFolder(fid = "survey_data", name = "survey data")
sur2013 = mykml$getFolder("2013")$getFolder("survey_data")
sur2013$addFolder(fid = "ports", name = "ports")

x = data.frame(cbind(c(45.9178, 46.807), c(-59.967, -60.321)))
names(x) = c("lat", "lon")

sur2013$getFolder("ports")$addPoint(x) #Demonstrate add data to folder

#mykml$preview()


brent0/kmlbuilder documentation built on Feb. 2, 2024, 2:05 a.m.