Learn R Programming

vegtable (version 0.1.3)

vegtable2kml: Mapping of plot observations.

Description

This function is a wrapper of kml producing and displaying KML files.

Usage

# S4 method for data.frame
vegtable2kml(obj, file, coords=~ Longitude + Latitude,
                srs=CRS("+proj=longlat +datum=WGS84"))

# S4 method for vegtable vegtable2kml(obj, file, coords=~ LONGITUDE + LATITUDE, srs=CRS("+proj=longlat +datum=WGS84"))

Arguments

obj

Input object containing coordinate values.

file

Character value with the name of output file (including file extension).

coords

Either a character vector or a formula indicating the names of coordinate values.

srs

Spatial reference system as proj4string.

Value

A KML file, which will be automatically opened in Google Earth.

Details

Georeferenced plots can be quickly displayed in Google Earth using this function.

Examples

Run this code
# NOT RUN {
library(vegtable)
data(Kenya_veg)

## Plots containing Podocarpus observations
Kenya_veg@species <- subset(Kenya_veg@species, grepl("Podocarpus", TaxonName),
	slot="names")
	
Kenya_veg <- subset(Kenya_veg, TaxonUsageID %in%
	Kenya_veg@species@taxonNames$TaxonUsageID, slot="samples")

# }
# NOT RUN {
vegtable2kml(Kenya_veg, "Podocarpus.kml")
# }

Run the code above in your browser using DataLab