get_lonlat_seq: Generate a sequence of coordinates

Description Usage Arguments Details Value Examples

View source: R/functions.R

Description

Generate a repeating sequence of longitude and latitude coordinates based on a period of rotation.

Usage

1
get_lonlat_seq(lon, lat, n.period = 360, n.frames = n.period)

Arguments

lon

vector of arbitrary longitudes or starting longitude (starting point for constant globe rotation).

lat

vector of arbitrary latitudes or fixed, repeating latitude.

n.period

intended length of the period.

n.frames

intended number of frames in animation.

Details

lon and lat may be scalars or vectors. If scalar, lat is simply repeated n.frames times. If scalar, lon is always treated as a starting longitude and a rotational sequence of longitudes is beginning from lon is generated for a length equal to n.frames, repeating the sequence if necessary. If lon or lat are vectors, it is assumed that predefined custom sequences of longitude and latitude have been provided, so they are required to be of length n.period. However long it takes to iterate through the custom coordinates sequence ought to define the period. It also makes sense in this case for n.frames to remain equal to n.period if the custom sequence is not meant to be cyclical but rather a single pass. After this check the custom vectors are simply bound in a list.

Value

returns a list containing a longitude vector and a latitude vector.

Examples

1
2
3
4
5
6
7
8
# default 360 frames of 360-length period rotation,
get_lonlat_seq(0, 0) # beginning from lon 0, at lat 0

get_lonlat_seq(0, 0, n.frames=40) # same but only first 40 frames
get_lonlat_seq(0, 0, n.frames=400) # same but looping for 40 additional frames
get_lonlat_seq(-20, 30, n.period=60) # quicker period, begin from lon -20, at lat 30

get_lonlat_seq(1:60, 2:61, n.period=60) # custom sequence is simply put in list

leonawicz/mapmate documentation built on May 21, 2019, 5:09 a.m.