mapr: mapr

Description Usage Arguments Details Value Examples

View source: R/mapr.R

Description

Generate a land shapefile for a region of interest specified by telemetry data

Usage

1
mapr(dat, prj, buff)

Arguments

dat

a data frame of observations (see details)

prj

a PROJ.4 compatable projection for the region of interest *NOT* WGS84. If dat inherits sf this will be scraped from the dataframe

buff

a buffer to expand region of interest (specified in metres) DEFAULT is 1e6 m (1000 km)

Details

Telemetry data is given either as an sf dataframe, or a tibble where each row is an observed location and columns

'id'

individual animal identifier,

'date'

observation time (POSIXct, GMT),

'lon'

observed longitude,

'lat'

observed latitude,

'...'

other columns will be ignored

Value

world_shp

a projected shapefile for the region of interest taken from Andy South's rworldmap package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
require(tidyverse)
require(sf)
data(ellie)
prj <- '+proj=laea +lat_0=-60 +lon_0=70 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'
world_shp <- mapr(ellie, prj, buff = 1e6)

ggplot() +
  geom_sf(aes(), data = world_shp) +
  geom_sf(aes(), data = st_as_sf(ellie, coords = c('lon', 'lat')) 
      st_set_crs('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'))

## End(Not run)

jamesgrecian/mapr documentation built on Jan. 10, 2021, 4:38 a.m.