Skip to content

Commit

Permalink
Update gps vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Jan 7, 2019
1 parent b3af68b commit a42a16a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions vignettes/gps-tracks.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

0 comments on commit a42a16a

Please sign in to comment.