NCEP.track2kml {RNCEP}R Documentation

Plot a track in Google Earth

Description

This function creates a .kml file from a time series of point locations (e.g. as returned by NCEP.flight or measured with a GPS device) that can be viewed as a track in Google Earth.

Usage

NCEP.track2kml(latitude, longitude, datetime, altitude=NULL, 
  col.variable=NULL, col.scheme=NULL, point.alpha=255, 
  line.color='goldenrod', line.alpha=255, size.variable=NULL,
  point.names=NULL, data.variables=NULL, output.filename='track',
  descriptive.filename=NULL)

Arguments

latitude

A numeric vector of latitudes in decimal degrees

longitude

A numeric vector of longitudes in decimal degrees

datetime

A character vector of datetime increments in the format "%Y-%M-%D %H:%M:%S".

altitude

An optional vector of altitudes in meters.

col.variable

An optional numeric vector upon which the color of each point should be based

col.scheme

A character description of the color scheme to use in coloring the points. Several options, see Details.

point.alpha

A numeric vector of length one indicating the transparency of all points on a scale from 0 (transparent) to 255 (opaque)

line.color

An character expression (any of colors or hexadecimal notation), or numeric indicating the color of the line connecting the point locations.

line.alpha

A numeric vector of length one indicating the transparency of the line connecting the point locations on a scale from 0 (transparent) to 255 (opaque)

size.variable

An optional numeric vector upon which the size of the points should be based

point.names

An optional character vector of containing names for each point

data.variables

An optional data.frame containing any descriptor information for each point. See Details.

output.filename

A character expression giving the name of the resulting output file. This should not include the .kml extension.

descriptive.filename

The name of the object in the .kml file. Defaults to output.filename.

Details

There are several options for specifying col.scheme. A single color may be specified for all points (using e.g. 'red', 2, or "#FF0000"), specific colors may be given for each point (e.g. c('red','blue','green', etc.) or codec('#FF0000','#0000FF','#00FF00', etc.)), or the function can automatically assign colors, according to the values in clo.variable, if col.scheme is any color palette in display.brewer.all or one of the recognizezd R color palettes (i.e. 'rainbow', 'heat.colors', 'terrain.colors', 'topo.colors', 'cm.colors', or 'bpy.colors'). An alpha value (0-255) may be supplied to point.alpha to adjust transparencies.

In the output .kml file, each point along the track contains a table of values. By default, this table contains the latitude, longitude, and datetime. Variables contained in the data.frame described in data.variables will also be included in this table.

The altitude associated with each point, i.e. those passed to the altitude argument, should be supplied in meters. For an example of how to assign general altitudes from pressure levels, see the Examples below.

Depending on col.scheme, this function may require RColorBrewer or sp.

Value

This function returns no data. It creates a .kml file in the current working directory.

Author(s)

Michael U. Kemp <mukemp+RNCEP@gmail.com>

References

To cite package 'RNCEP' in publications use:

Kemp, M. U., van Loon, E. E., Shamoun-Baranes, J., and Bouten, W. 2011. RNCEP:global weather and climate data at your fingertips. – Methods in Ecology and Evolution. DOI:10.1111/j.2041-210X.2011.00138.x.

See Also

NCEP.flight

Examples

## Not run: 
## Load the gull dataset ##
data(gull)

## Create a subset of the full dataset ##
g <- gull[1:100,]

## Create a .kml file from a portion of the GPS track ##
NCEP.track2kml(latitude=g$latitude, longitude=g$longitude,
    datetime=as.character(g$datetime), altitude=g$altitude, 
    col.variable=g$altitude, col.scheme='heat.colors',
    point.alpha=255, line.color='goldenrod', line.alpha=255,
	size.variable=NULL, point.names=NULL, 
    data.variables=data.frame(g$altitude),
	output.filename='track', descriptive.filename=NULL)

## End(Not run)

[Package RNCEP version 1.0.10 Index]