Description Usage Arguments Value Author(s) See Also Examples
This function is used to serialize a KML document to a file. If it is large or has references to local files, we create a KMZ file to create a compressed archive containing all the files. This can then be distributed as a single entity. Alternatively, the single document is serialized to a regular KML file.
1 2 3 4 |
doc |
the in-memory KML document that is to be serialized |
file |
the name of the output file. If this is an object of class
|
... |
additional parameters currently passed to |
force |
a logical value that controls whether to force the search for images and create a KMZ file. |
clone |
a logical value controlling whether we should copy (or clone) the XML document before making any changes to it as we create a KMZ archive. |
useKMZ |
a logical value that controls whether to use KMZ or just
KML. If this is left as |
baseDir |
a character vector. This is used when we rename local
files as entries in the ZIP archive we create. The idea is
possibly simplest to explain with an example.
Suppose our KML document refers to an Icon file in the RKML package
using the full path, e.g. /Users/duncan/Rpackages/RKML/Icons/reddot.png.
We don't want this full path in the KMZ archive, but probably want
Icons/reddot.png. So we want to remove the prefix
/Users/duncan/Rpackages/RKML/.
This parameter |
xpathQuery |
the xpath query string used to find the nodes of interest that may have references to external files. |
fixHTMLRefs |
a logical value that controls whether we check
for references to local external files within the HTML code within
|
The name of the file that was created, a character vector of length 1.
Duncan Temple Lang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | styles = list("ball_green" =
list("IconStyle" = list("scale" = "0.5",
"Icon" = c("href" = system.file("Icons", "greendot.png", package = "RKML"))),
"BalloonStyle" = "$description"),
"ball_red" =
list("IconStyle" = list("scale" = "0.5",
"Icon" = c("href" = system.file("Icons", "reddot.png", package = "RKML"))),
"BalloonStyle" = "$description"),
"line_green" = list(LineStyle = list(color = I("ff8adfb2"), width = 4)),
"line_red" = list(LineStyle = list(color = I("ff999afb"), width = 2)))
data(elephantSeal)
outDays = 44
direction = factor(c(rep("Out", outDays),
rep("Return", nrow(elephantSeal) - outDays)))
o = kmlTime(elephantSeal, elephantSeal$date,
name = format(elephantSeal$date, "%d-%m"),
style = c("ball_green", "ball_red")[direction],
lty = c("line_green", "line_red")[direction],
"Elephant Seal Travel Path",
"Elephant seal data <a href='http://www.stat.berkeley.edu/~brill'>Stewart & Brillinger</a>",
docStyles = styles)
makeKMZArchive(o, "seal.kmz")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.