Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

Author(s)

Pierre Roudier, Tomislav Hengl and Dylan Beaudette

See Also

Examples

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)

plotKML

Visualization of Spatial and Spatio-Temporal Objects in Google Earth

v0.8-1
GPL
Authors
Tomislav Hengl [cre, aut], Andrea Gilardi [ctb], Pierre Roudier [ctb], Dylan Beaudette [ctb], Edzer Pebesma [ctb], Michael Blaschek [ctb]
Initial release
2021-04-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.