Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

readGPS

GPSbabel read interface


Description

The function reads a data frame from an attached GPS using the external program gpsbabel. The columns of the data frame need to be identified by hand because different GPS order NMEA data in different ways, and the columns should be converted to the correct classes by hand. Once the specifics of a particular GPS are identified, and ways of cleaning erroneous locations are found, the conversion of the output data frame into a usable one may be automated.

Usage

readGPS(i = "garmin", f = "usb:", type="w", invisible=TRUE, ...)

Arguments

i

INTYPE: a supported file type, default "garmin"

f

INFILE: the appropriate device interface, default "usb:", on Windows for serial interfaces commonly "com4:" or similar

type

"w" waypoints, or "t" track, or others provided in gpsbabel

invisible

Under Windows, do not open an extra window

...

arguments passed through to read.table

Details

The function just wraps: gpsbabel -i INTYPE -f INFILE -o tabsep -F - in system(), and reads the returned character vector of lines into a data frame. On some systems, INFILE may not be readable by ordinary users without extra configuration. The gpsbabel program must be present and on the user's PATH for the function to work. Typically, for a given GPS, the user will have to experiment first to find a set of data-cleaning tricks that work, but from then on they should be repeatable.

Value

A data frame of waypoint values

Author(s)

Patrick Giraudoux and Roger Bivand

References

Examples

## Not run: 
#b1 <- readGPS(f="usb:")
#str(b1)
#b2 <- b1[1:172,]
#wp0 <- b2[,c(2,3,4,8,9,19)]
#str(wp0)
#wp0$long <- wp0$V9
#wp0$lat <- as.numeric(as.character(wp0$V8))
#wp0$id <- as.character(wp0$V2)
#wp0$alt <- as.numeric(substring(as.character(wp0$V19), 1,
# (nchar(as.character(wp0$V19))-1)))
#wp0$time <- as.POSIXct(strptime(paste(as.character(wp0$V3),
# as.character(wp0$V4)), format="%d-%b-%y %H:%M:%S"))
#str(wp0)
#wp1 <- wp0[,-(1:6)]
#str(wp1)
#summary(wp1)

## End(Not run)

maptools

Tools for Handling Spatial Objects

v1.1-1
GPL (>= 2)
Authors
Roger Bivand [cre, aut] (<https://orcid.org/0000-0003-2392-6140>), Nicholas Lewin-Koh [aut], Edzer Pebesma [ctb], Eric Archer [ctb], Adrian Baddeley [ctb], Nick Bearman [ctb], Hans-Jörg Bibiko [ctb], Steven Brey [ctb], Jonathan Callahan [ctb], German Carrillo [ctb], Stéphane Dray [ctb], David Forrest [ctb], Michael Friendly [ctb], Patrick Giraudoux [ctb], Duncan Golicher [ctb], Virgilio Gómez Rubio [ctb], Patrick Hausmann [ctb], Karl Ove Hufthammer [ctb], Thomas Jagger [ctb], Kent Johnson [ctb], Matthew Lewis [ctb] (<https://orcid.org/0000-0003-2244-4078>), Sebastian Luque [ctb], Don MacQueen [ctb], Andrew Niccolai [ctb], Edzer Pebesma [ctb], Oscar Perpiñán Lamigueiro [ctb], Ethan Plunkett [ctb], Ege Rubak [ctb] (<https://orcid.org/0000-0002-6675-533X>), Tom Short [ctb], Greg Snow [ctb], Ben Stabler [ctb], Murray Stokely [ctb], Rolf Turner [ctb]
Initial release
2021-03-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.