Postdoctoral Position in Biogeographic Inference Tools (2 years)
Often, one may have a data frame of locations with attributes such as species names and may wish to create a GPX file from this data to use with a navigation software such as a GPS device. This can be achieved in four steps as follows:
library(terra)
x <- data.frame(NAME=c("Species1", "Species2", "Species3"),
LAT=c(70.11, 70.032145, 68.619535),
LON=c(-148.52, -148.640821, -149.556137))
head(x)
v <- vect(x, geom=c("LON", "LAT"), crs="+proj=longlat +datum=WGS84")
writeVector(v, "~/GPS_wapoints.gpx", filetype="GPX", layer="waypoints",
overwrite=TRUE, options="GPX_USE_EXTENSIONS=yes")
Connect your GPS device to a computer, and drag and drop the new file in the GPX folder of your GPS device. That’s it!