fetch_trktg_positions: Download Position (Fix) Data from track tag website

View source: R/fetch_trktg.R

fetch_trktg_positionsR Documentation

Download Position (Fix) Data from track tag website

Description

Retrieves GPS data optionally filtered by date or collar.

Usage

fetch_trktg_positions(
  device_id = NULL,
  start_date = NULL,
  end_date = NULL,
  time_zone = Sys.timezone(),
  as_sf = FALSE,
  sf_crs = 4326
)

Arguments

device_id

A single device id, or a list or vector of device ids, or NULL for all devices associated with current account. Device ids can be found on the track tag portal (Device ID/UID), or by examining the 'user_id' column in the tibble returned by fetch_trktg_devices.

start_date

Only fixes at or after start_date will be included in the output. Must be a POSIX date or date/time object. If NULL Jan 1 1970 is used.

end_date

Only fixes at or before end_date are included, analagous to start_date above. If NULL current date/time is used.

time_zone

Time zone used to convert date values to POSIX.

as_sf

Boolean indicating if the result should be converted to an sf object.

sf_crs

Coordinate referenece system for converting to sf. Only CRS 4326 (WGS84) has been tested, coordinates may not be parsed correctly for other systems.

Value

A tibble or sf object with 21 columns:

device_id

User label assigned through track tag portal (character)

Date

Fix date/time (POSIXct)

Received

Date/time received via satellite (character)

Address

Address nearest the GPS fix (character)

Lat/Lng

GPS coordinates (character)

Speed

Speed with units (character)

Heading

Unknown (character)

Altitude

Unknown (character)

Via

Transmission method (character)

Near place(s)

Unknown (character)

Inside geofence(s)

Unknown (character)

Extra

Unknown (character)

I/O

Unknown (character)

See Also

fetch_trktg_devices for downloading a list of transmitters associated with the current account.

Examples

## Not run: 
trktg_login("some_user", "some_users_pw")

# all fixes for all transmitters in 2024
fixes <- fetch_trktg_positions(
  start_date = "2024-01-01 00:00:00",
  end_date = "2025-01-01 00:00:00"
)

# all fixes for a single transmitter
fixes_single_tr <- fetch_trktg_positions(device_id = "012345678")

# all fixes for multiple transmitters
fixes_2_devices <- fetch_trktg_positions(
  device_id = c("012345678", "012345679")
)

# fixes from the last week for a single transmitter
fixes <- fetch_trktg_positions(
  device_id = "012345678",
  start_date = Sys.Date() - 7
)

# fixes from the last week as an sf object
fixes <- fetch_trktg_positions(
  start_date = Sys.Date() - 7,
  as_sf = TRUE
)

trktg_logout()

## End(Not run)

Huh/collar documentation built on Jan. 19, 2025, 1:15 a.m.