Learn R Programming

plotKML (version 0.8-3)

kml_layer.SpatialPolygons: Writes spatial polygons to KML

Description

Writes object of class "SpatialPolygons*" to KML with a possibility to parse attribute variables using several aesthetics arguments.

Usage

kml_layer.SpatialPolygons(obj, subfolder.name = paste(class(obj)),
        extrude = TRUE, tessellate = FALSE, 
        outline = TRUE, plot.labpt = FALSE, z.scale = 1, 
        LabelScale = get("LabelScale", envir = plotKML.opts), 
        metadata =  NULL, html.table = NULL, TimeSpan.begin = "", 
        TimeSpan.end = "", colorMode = "normal", …)

Arguments

obj

object of class "SpatialPolygons*"

subfolder.name

character; optional subfolder name

extrude

logical; specifies whether to connect the point to the ground with a line

tessellate

logical; specifies whether to connect the LinearRing to the ground

outline

logical; specifies whether to outline the polygon

plot.labpt

logical; specifies whether to add the label point (polygon centre)

z.scale

numeric; exaggeration in vertical dimension

LabelScale

numeric; scale factor for size of labels

metadata

(optional) specify the metadata object

html.table

optional description block (html) for each GPS point (vertices)

TimeSpan.begin

(optional) beginning of the referent time period

TimeSpan.end

(optional) end of the referent time period

colorMode

(optional) KML color mode (normal or random)

additional style arguments (see aesthetics)

Details

Label points are be default not plotted. We recommend adding the legend to attribute maps instead. Transparency can be set by using the alpha argument. TimeSpan.begin and TimeSpan.end are optional TimeStamp vectors:

yyyy-mm-ddThh:mm:sszzzzzz

Use the same time values for both TimeSpan.begin and TimeSpan.end if the measurements refer to a single moment in time. TimeSpan.begin and TimeSpan.end can be either a single value or a vector of values.

See Also

kml_layer.SpatialLines, kml_layer.STIDF, , plotKML-method

Examples

Run this code
# NOT RUN {
library(rgdal)
library(sp)
data(eberg_zones)
names(eberg_zones)
## visualize zones using random colors:
kml.file = paste0(tempdir(), "/eberg_zones.kml")
kml(eberg_zones, file.name=kml.file, colorMode = "random")
## with labels:
kml.file2 = paste0(tempdir(), "/eberg_zones2.kml")
kml(eberg_zones, file.name=kml.file2, colour = ZONES, 
    plot.labpt = TRUE, labels = ZONES, kmz = TRUE, balloon=TRUE)
# }

Run the code above in your browser using DataLab