Learn R Programming

SDLfilter (version 2.0.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, sdata.CRS = "WGS", output = "open", type = "point", ...)

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.

sdata.CRS

Coordinate reference system (CRS) for the input location data. If the input data is not in WGS, the specific CRS needs to be supplied as a PROJ.4 notation or EPSG code. (e.g. "+proj=utm +zone=37 +datum=WGS84 +units=m +no_defs" or "EPSG:32637")

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.

Value

A kml file

See Also

map_track

Examples

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

# }
# NOT RUN {
#### 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