to_map: Plot location data on a map

View source: R/to_map.R

to_mapR Documentation

Plot location data on a map

Description

Function to plot tracking data on a map or a satellite image.

Usage

to_map(
  sdata,
  xlim = NULL,
  ylim = NULL,
  margin = 10,
  bgmap = NULL,
  google.key = NULL,
  map.bg = "grey",
  map.col = "black",
  zoom = NULL,
  point.bg = "yellow",
  point.col = "black",
  point.symbol = 21,
  point.size = 1,
  line.col = "lightgrey",
  line.type = 1,
  line.size = 0.5,
  title = "id",
  title.size = 11,
  axes.text.size = 11,
  axes.lab.size = 11,
  multiplot = TRUE,
  nrow = 1,
  ncol = 1
)

Arguments

sdata

A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon". The function creates a map for each unique "id" (e.g. transmitter number, identifier for each animal). "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.

xlim, ylim

Limits for x and y axes. If not specified, the values are determined as the maximum range of the input data plus an additional margin (see margin).

margin

Set the amount of spaces added around the periphery of the plot. The value is scaled to the plot. The smaller value increases the margin.

bgmap

A data frame of a background map data, containing the following headers: "long", "lat", "group". If not specified, the world map is used. Google Maps ("terrain", "satellite", "roadmap", "hybrid") can also be queried.

google.key

If Google Maps are queried, a valid API key (a string) needs to be specified here. See register_google for details.

map.bg

Background colour of the map. This argument is ignored when any Google Maps is selected.

map.col

Outline colour of the map. This argument is ignored when any Google Maps is selected.

zoom

Map zoom for Google Maps. Default (NULL) to estimate the zoom from each data set. For other options, see get_map for details.

point.bg

The colour to fill in a symbol.

point.col

The colour for the outline of a symbol.

point.symbol

An integer or a string to specify the symbol type. See shape for details.

point.size

An integer to specify the size of the symbol.

line.col

The colour of the line that connects consecutive points.

line.type

The type of the line that connects consecutive points. See linetype for details.

line.size

An integer to specify the thickness (width) of the line that connects consecutive points.

title

The main title for each plot. If not specified, the "id" will be used.

title.size

An integer to specify the size of the title.

axes.text.size

An integer to specify the size of the axes characters.

axes.lab.size

An integer to specify the size of the axes labels.

multiplot

Logical. If TRUE (default), multiple plots are displayed on the same page.

nrow

An integer to specify the number of rows in the multiple plot page.

ncol

An integer to specify the number of columns in the multiple plot page.

Value

An arrangelist is returned when multiplot is TRUE. Otherwise a list is returned.

Author(s)

Takahiro Shimada

See Also

dupfilter, ddfilter, vmax, vmaxlp

Examples

#### Load data sets
## Fastloc GPS data obtained from two green turtles
data(turtle)
data(turtle2)
turtles<-rbind(turtle, turtle2)

#### Filter temporal and/or spatial duplicates
turtle.dup <- dupfilter(turtles, step.time=5/60, step.dist=0.001)
 

#### ddfilter
V <- vmax(turtle.dup)
VLP <- vmaxlp(turtle.dup)
turtle.dd <- ddfilter(turtle.dup, vmax=V, vmaxlp=VLP)


#### Plot filtered data for each animal
## using the low-resolution world map
to_map(turtle.dd, point.size = 2, line.size = 0.5, axes.lab.size = 0, ncol=2, nrow=1)

## Not run: 
## using the high-resolution google satellite images
to_map(turtle.dd, bgmap = "satellite", google.key = "key", ncol=2)

## End(Not run)

SDLfilter documentation built on Nov. 10, 2023, 1:11 a.m.