Skip to content

Commit a42a16a

Browse files
committed
Update gps vignette
1 parent b3af68b commit a42a16a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

vignettes/gps-tracks.Rmd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,28 @@ st_layers("trace.gpx")
4848
```
4949

5050
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).
51+
The following code chunk imports and plots the 'tracks' layer, which is a MULTILINESTRING geometry in sf, and only 1 row of data:
5152

5253
```{r}
5354
r = st_read("trace.gpx", layer = "tracks")
55+
class(r)
56+
st_geometry_type(r)
57+
nrow(r)
5458
plot(r$geometry)
5559
```
5660

61+
Other than the geometry, this object has limited information about the route in the fields.
62+
The richest field is 'Description', which contains the following summary data:
63+
64+
```{r, results='asis'}
65+
class(r$desc)
66+
as.character(r$desc)
67+
```
68+
69+
The data can also be imported as points, as follows:
70+
71+
```{r}
72+
p = read_sf("trace.gpx", layer = "track_points")
73+
plot(p)
74+
```
75+

0 commit comments

Comments
 (0)