to_kmz: Generate KMZ from locations and track

View source: R/to_kmz.R

to_kmzR Documentation

Generate KMZ from locations and track


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


to_kmz(sdata, crs = 4326, = "id", ...)



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.


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

A character specifying the output file name.


Optional arguments passed to kml_layer for points.


A kmz file


Takahiro Shimada

See Also



## Tracking data of two green turtles
data(turtle); data(turtle2)

## Filter data
d1 <- ddfilter(dupfilter(turtle))
d2 <- ddfilter(dupfilter(turtle2))

## Combine two data
d <- list(d1, d2) 

## Not run: 
## Generate a kmz file from each tracking data
shp <- ''
for(i in 1:2){
  # labels for points (date and time)
  pn <- d[[i]]$DateTime
  # Apply a colour gradient to points based on the date and time
  pt_col <- hcl.colors(n = nrow(d[[i]]), palette = 'Zissou 1')
  # Generate a kmz file
  to_kmz(d[[i]], shape = shp, colour_scale = pt_col, colour = pn, points_names = pn, LabelScale = 0)

## End(Not run)

SDLfilter documentation built on April 17, 2023, 9:09 a.m.