From a42a16a2000f4e4d2928b09263ca6898235e8d1c Mon Sep 17 00:00:00 2001 From: Robin Lovelace Date: Mon, 7 Jan 2019 12:05:01 +0000 Subject: [PATCH] Update gps vignette --- vignettes/gps-tracks.Rmd | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/vignettes/gps-tracks.Rmd b/vignettes/gps-tracks.Rmd index 832c149..80a2d26 100644 --- a/vignettes/gps-tracks.Rmd +++ b/vignettes/gps-tracks.Rmd @@ -48,9 +48,28 @@ st_layers("trace.gpx") ``` The previous code code chunk downloads the trace from OSM and queries the 'layers' that can be imported (note there are 5, but only 'tracks' and 'track_points' are available). +The following code chunk imports and plots the 'tracks' layer, which is a MULTILINESTRING geometry in sf, and only 1 row of data: ```{r} r = st_read("trace.gpx", layer = "tracks") +class(r) +st_geometry_type(r) +nrow(r) plot(r$geometry) ``` +Other than the geometry, this object has limited information about the route in the fields. +The richest field is 'Description', which contains the following summary data: + +```{r, results='asis'} +class(r$desc) +as.character(r$desc) +``` + +The data can also be imported as points, as follows: + +```{r} +p = read_sf("trace.gpx", layer = "track_points") +plot(p) +``` +