layer.SpatialPoints: Writes spatial points to KML

kml_layer.SpatialPointsR Documentation

Writes spatial points to KML

Description

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

Usage

kml_layer.SpatialPoints(obj, subfolder.name = paste(class(obj)), 
        extrude = TRUE, z.scale = 1, 
        LabelScale = get("LabelScale", envir = plotKML.opts), 
        metadata = NULL, html.table = NULL, TimeSpan.begin = "",
        TimeSpan.end = "", points_names, ...)

Arguments

obj

object of class "SpatialPoints*"

subfolder.name

character; optional subfolder name

extrude

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

z.scale

numeric; exaggeration in vertical dimension

LabelScale

numeric; scale factor for size of labels

metadata

(optional) specify the metadata object

html.table

(optional) specify the description block (html) for each point

TimeSpan.begin

(optional) beginning of the referent time period

TimeSpan.end

(optional) end of the referent time period

points_names

character; forces the point labels (size of the character vector must equal the number of the points)

...

additional style arguments (see aesthetics)

Details

TimeSpan.begin and TimeSpan.end are optional TimeStamp vectors:

yyyy-mm-ddThh:mm:sszzzzzz

For observations at point support (a single moment in time), use the same time values for both TimeSpan.begin and TimeSpan.end. TimeSpan.begin and TimeSpan.end can be either a single value or a vector of values.
Optional aesthetics arguments are shapes (icons), colour, sizes, altitude (if not a 3D object; variable to be used to specify altitude above ground), altitudeMode (altitude mode type (clampToGround, relativeToGround or absolute). Although this function can be used to plot over five variables, more than three aesthetics arguments is not recommended (e.g. limit to size and colour).

Author(s)

Pierre Roudier, Tomislav Hengl and Dylan Beaudette

See Also

kml_layer.STTDF, plotKML-method

Examples

data(eberg)
data(SAGA_pal)
library(sp)
library(rgdal)
coordinates(eberg) <- ~X+Y
proj4string(eberg) <- CRS("+init=epsg:31467")
names(eberg)
# subset to 10 percent:
eberg <- eberg[runif(nrow(eberg))<.1,]
## Not run: # plot the measured CLAY content:
kml(eberg, labels = CLYMHT_A)
shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png"
# color only:
kml(eberg, shape = shape, colour = SLTMHT_A, labels = "", colour_scale = SAGA_pal[[1]])
# two variables at the same time:
kml(eberg, shape = shape, size = CLYMHT_A, colour = SLTMHT_A, labels = "")
# two aesthetics elements are effective in emphasizing hot-spots:
kml(eberg, shape = shape, altitude = CLYMHT_A*10, extrude = TRUE, 
  colour = CLYMHT_A, labels = CLYMHT_A, kmz = TRUE)

## End(Not run)

## example of how plotKML is programmed:
data(HRtemp08)
HRtemp08[1,]
library(XML)
p1 = newXMLNode("Placemark")
begin <- format(HRtemp08[1,"DATE"]-.5, "%Y-%m-%dT%H:%M:%SZ")
end <- format(HRtemp08[1,"DATE"]+.5, "%Y-%m-%dT%H:%M:%SZ")
txt <- sprintf('<name>%s</name><TimeStamp><begin>%s</begin><end>%s</end></TimeStamp>
    <Point><coordinates>%.4f,%.4f,%.0f</coordinates></Point>', HRtemp08[1,"NAME"], 
    begin, end, HRtemp08[1,"Lon"], HRtemp08[1,"Lat"], 0)
parseXMLAndAdd(txt, parent=p1)
p1

Envirometrix/plotKML documentation built on June 13, 2022, 11:21 p.m.