I would like to import waypoints from my Garmin GPSmap 62 into R. I have about 270 waypoints saved on the GPS unit. I can use Garmin's BaseCamp program to export them, but I would like to do this with R.

Once I plug the Garmin unit into my computer (Mac OS X) via USB, the file system I see is the following:

~ $ cd /Volumes/GARMIN/
/Volumes/GARMIN $ ls
Documents   Garmin      autorun.inf
/Volumes/GARMIN $ cd Garmin/
/Volumes/GARMIN/Garmin $ ls
BirdsEye             Garmintriangletm.ico gmapbmap.sum
CustomMaps           JPEG                 gmaptz.img
CustomSymbols        Profiles             startup.txt
ExtData              SQL                  system.xml
Filters              Text                 wytopo11.img
GPX                  fs_image.ver
GarminDevice.xml     gmapbmap.img
/Volumes/GARMIN/Garmin $ cd GPX
/Volumes/GARMIN/Garmin/GPX $ ls
Archive                 Waypoints_12-MAY-13.gpx Waypoints_19-MAR-16.gpx
Current                 Waypoints_13-APR-15.gpx Waypoints_20-OCT-16.gpx
Nav                     Waypoints_13-JUN-13.gpx Waypoints_21-MAR-16.gpx
Waypoints_01-MAY-14.gpx Waypoints_13-MAY-13.gpx Waypoints_21-MAY-14.gpx
Waypoints_02-APR-15.gpx Waypoints_13-MAY-14.gpx Waypoints_21-OCT-16.gpx
Waypoints_02-MAY-15.gpx Waypoints_14-JUN-13.gpx Waypoints_22-MAR-16.gpx
Waypoints_03-APR-15.gpx Waypoints_14-MAR-16.gpx Waypoints_22-MAY-14.gpx
Waypoints_03-JUN-13.gpx Waypoints_14-MAY-13.gpx Waypoints_22-OCT-16.gpx
Waypoints_03-MAY-15.gpx Waypoints_14-MAY-14.gpx Waypoints_23-MAR-16.gpx
Waypoints_04-MAY-14.gpx Waypoints_15-APR-15.gpx Waypoints_23-MAY-14.gpx
Waypoints_05-APR-15.gpx Waypoints_15-JUN-13.gpx Waypoints_24-MAR-16.gpx
Waypoints_05-JUN-13.gpx Waypoints_15-MAR-16.gpx Waypoints_24-OCT-16.gpx
Waypoints_05-MAY-14.gpx Waypoints_15-MAY-14.gpx Waypoints_25-APR-15.gpx
Waypoints_06-APR-15.gpx Waypoints_16-MAR-16.gpx Waypoints_25-OCT-16.gpx
Waypoints_06-MAY-14.gpx Waypoints_16-MAY-13.gpx Waypoints_26-APR-15.gpx
Waypoints_07-JUN-13.gpx Waypoints_16-MAY-14.gpx Waypoints_26-MAR-16.gpx
Waypoints_08-APR-15.gpx Waypoints_17-JUN-13.gpx Waypoints_26-MAY-13.gpx
Waypoints_08-JUN-13.gpx Waypoints_17-MAR-16.gpx Waypoints_26-OCT-16.gpx
Waypoints_10-APR-15.gpx Waypoints_18-JUN-13.gpx Waypoints_27-APR-15.gpx
Waypoints_10-JUN-13.gpx Waypoints_18-MAR-16.gpx Waypoints_28-APR-14.gpx
Waypoints_10-MAR-16.gpx Waypoints_18-MAY-14.gpx Waypoints_29-APR-14.gpx
Waypoints_11-JUN-13.gpx Waypoints_18-OCT-16.gpx Waypoints_29-APR-15.gpx
Waypoints_11-MAY-13.gpx Waypoints_19-APR-15.gpx Waypoints_30-APR-14.gpx
Waypoints_12-MAR-16.gpx Waypoints_19-JUN-13.gpx Waypoints_30-APR-15.gpx

Within the GPX directory, there is a Current directory that contains Current.gpx.

I'm not sure if that is the file that contains my waypoints, but this is what I started with.

I tried to load this into R with rgdal:

> readOGR('/Volumes/GARMIN/Garmin/GPX/Current/Current.gpx', layer="track_points")
OGR data source with driver: GPX 
Source: "/Volumes/GARMIN/Garmin/GPX/Current/Current.gpx", layer: "track_points"
with 9759 features
It has 26 fields

There are way more entries than waypoints that I expect to have. Also, none of the columns in the data slot of this SpatialPolygonsDataFrame have the names of the waypoints.

So, am I looking at the wrong file? Is there a better way to load the waypoints into R?

1 Answer 1


I found that (not surprisingly) the waypoints are found in all of the .gpx files whose filenames start with "Waypoints". I also found the function plotKML::readGPX to be the most intuitive for me.


# identify gpx files that contain waypoints
files <- list.files(pattern='\\d\\d.gpx$', full.names=TRUE)

# combine all waypoints into a dataframe
allwaypoints <- list()
for (i in 1:length(files)) {
    allwaypoints[[i]] <- readGPX(files[i], tracks=FALSE, routes=FALSE)$waypoints[, c('name', 'lon', 'lat', 'time')]

allwaypoints <- do.call('rbind', allwaypoints)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.