readGPS               package:maptools               R Documentation

_G_P_S_b_a_b_e_l _r_e_a_d _i_n_t_e_r_f_a_c_e

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       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'

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     A data frame of waypoint values

_A_u_t_h_o_r(_s):

     Patrick Giraudoux and Roger Bivand

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.gpsbabel.org>

_E_x_a_m_p_l_e_s:

     ## 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)

