Learn R Programming

plotKML (version 0.5-4)

kml_layer.SoilProfileCollection: Writes a list of soil profiles to KML

Description

Writes object of type "SoilProfileCollection" (a number of soil profiles with site and horizon data) to KML. Several attributes such as horizontal and vertical exaggeration can be passed via arguments.

Usage

kml_layer.SoilProfileCollection(obj, 
     var.name, var.min = 0, var.scale, 
     site_names = profile_id(obj), 
     method = c("soil_block", "depth_function")[1], 
     block.size = 100, 
     color.name, z.scale = 1, x.min, max.depth = 300,
     plot.points = TRUE, 
     LabelScale = get("LabelScale", envir = plotKML.opts) * 0.7,
     IconColor = "#ff0000ff", 
     shape = paste(get("home_url", envir = plotKML.opts), 
         "circlesquare.png", sep = ""), 
     outline = TRUE, visibility = TRUE, extrude = TRUE, tessellate = TRUE, 
     altitudeMode = "relativeToGround", camera.distance = 0.01, 
     tilt = 90, heading = 0, roll = 0, 
     metadata = NULL, html.table = NULL, plot.scalebar = TRUE,
     scalebar = paste(get("home_url", envir = plotKML.opts), 
         "soilprofile_scalebar.png", sep = ""), 
     ...)

Arguments

obj
object of class "SoilProfileCollection" (package http://CRAN.R-project.org/package=aqp{aqp})
var.name
target column name in the horizons slot
var.min
smallest value
var.scale
exaggeration in vertical dimension
site_names
site names as listed in the site table
method
visualization type (soil block or depth-function)
block.size
(optional) size of the block of land
color.name
(optional) column name carrying the color information for each horizon
z.scale
exaggeration in horizontal direction
x.min
offset in longitude direction (in decimal degrees)
max.depth
maximum height/depht of a profile in cm
plot.points
logical; specifies whether to plot horizon centres with attribute values
LabelScale
numeric; specifies size of the labels for each horizon
IconColor
colors for the labels for each horizon
shape
default icon for Google placemarks
outline
logical; specifies whether to draw outline for the soil-depth functions (or simply a line)
visibility
logical; specifies whether to make the layer visible
extrude
logical; specifies whether to extrude horizon centers
tessellate
logical; specifies whether to tessellate polygons
altitudeMode
by default relativeToGround
camera.distance
distance from a profile in arc degrees
tilt
angle between the direction of the LookAt position and the normal to the surface of the earth
heading
orientation towards north
roll
rotation about the y axis
metadata
(optional) spatial metadata for the input object
html.table
(optional) tabular content (attributes) for each horizon
plot.scalebar
logical; specifies whether to plot a scale bar next to the profile plot
scalebar
default icon for the scale bar
...
additional style arguments

Details

Horizon depths are typically expressed in cm, hence the default exaggeration factor (z.scale) is 10. It is highly recommended to turn off the terrain layer in Google Earth, otherwise Google Earth will deform the plots in areas of high relief.

References

  • Algorithms for Quantitative Pedology (http://CRAN.r-project.org/package=aqp)

See Also

kml_layer.SpatialPhotoOverlay, plotKML-method

Examples

Run this code
## install.packages("aqp", repos="http://R-Forge.R-project.org")
library(aqp)
library(fossil)
library(plyr)
data(ca630)
## Promote to SoilProfileCollection
ca <- join(ca630$lab, ca630$site, type='inner')
depths(ca) <- pedon_key ~ hzn_top + hzn_bot
## extract site data
site(ca) <- ~ mlra + ssa + lon + lat + cntrl_depth_to_top + cntrl_depth_to_bot + sampled_taxon_name
# generate SpatialPoints
library(sp)
coordinates(ca) <- ~ lon + lat
## assign CRS data
proj4string(ca) <- "+proj=longlat +datum=NAD83"
## plot changes in base saturation by sum of cations method (pH 8.2):
kml(ca, method = "depth_function", file.name = "ca_bs_8_2.kml", 
  var.name="bs_8.2", balloon = TRUE)
## plot changes in cation exchange capacity by sum of cations method (pH 8.2):
kml(ca, file.name = "ca_CEC8_2.kml", var.name="CEC8.2", IconColor = "#ff009000")
## plot soil profile as 'block':
kml(ca, file.name = "ca_CEC8_2_block.kml", var.name="CEC8.2", balloon = TRUE)

Run the code above in your browser using DataLab