writeGPX {pgirmess}R Documentation

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.

Note

for more standard GPX file, see writeOGR with arguments like layer="waypoints", driver="GPX", dataset_options ="GPX_USE_EXTENSIONS=yes" can alternately be used; readOGR with arguments like layer="waypoints", drop_unsupported_fields=TRUE

See Also

writeOGR

Examples


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


[Package pgirmess version 1.4.3 Index]