Learn R Programming

SDLfilter (version 2.3.1)

kml_track: Generate KML from locations

Description

Function to generate a kml file from tracking data. This is a wrapper of plotKML and kml, specifically designed to generate a kml file from tracking data.

Usage

kml_track(sdata, crs = 4326, output = "open", type = "point", ...)

Value

A kml file

Arguments

sdata

A data frame containing location data of one individual, with the following column headers: "id", "DateTime", "lat", "lon". "id" is an identifier of the individual. "DateTime" is the GMT date & time of each location in class POSIXct or character with the following format "2012-06-03 01:33:46". "lat" and "lon" are the latitude and longitude of each location in decimal degrees.

crs

A number specifying the European Petroleum Survey Group (EPSG) code for the input location data.

output

A string specifying whether to 'open' or 'save' the output. The output will be saved in the current working directory.

type

Type of the output. 'point' or 'line.

...

Optional arguments passed to plotKML and kml.

Author

Takahiro Shimada

See Also

map_track

Examples

Run this code
#### Fastloc GPS data obtained from a green turtle
data(turtle)

if (FALSE) {
#### See the data on Google earth
## points with time stamps
kml_track(turtle, output = 'open', type = 'point', 
points_names = turtle$DateTime, colour_scale = 'yellow')

## lines
kml_track(turtle, output = 'open', type = 'line', colour = 'red')
 

#### Save the location points to the current working directory    
shape <- "http://maps.google.com/mapfiles/kml/pal2/icon26.png"
kml_track(turtle, output = 'save', type = 'point', shape = shape, colour = 'yellow')
}

Run the code above in your browser using DataLab