pgirmess (version 1.6.9)

writeGPX: Convert a data frame into a GPX file of waypoints or track

Description

Convert a data frame of labels, geographical coordinates and optionally altitude into a GPX file of waypoints or track that can be uploaded to Garmin GPS

Usage

writeGPX(x, filename = "",type="w")

Arguments

x

data.frame of three (optionally four) columns (see details)

filename

a character string naming the file to print to. If '""' (the default), prints to the standard output connection, the console (unless redirected by 'sink')

type

'w' for waypoints (default) or 't' for track

Details

The data frame must have three (optionally four) columns:

  1. character or integer, waypoint ID for waypoints ; column not read for track

  2. numeric, longitude (decimal degrees), negative for west

  3. numeric, latitude (decimal degrees), negative for south

  4. numeric, elevation (meters) (optional)

A suffix '.gpx' is added to the file name if not provided by user. The file obtained can be uploaded to Garmin GPS but cannot be read eg from MapSource for some reasons.

See Also

writeOGR

Examples

Run this code
# NOT RUN {
coords<-data.frame(ID=c("C18J01", "C18J02"),Long= c(-46.996602, 47.002745),
Lat=c(-6.148734, 6.14829),Alt=c(250,1230))

writeGPX(coords) # waypoints
writeGPX(coords,type="t") # track

# }

Run the code above in your browser using DataCamp Workspace