Closed jud-mog closed 6 years ago
It certainly is. I would suggest switching to using sf if you're new to spatial data as it has some advantages over the sp package taught in this tutorial. Check this out as a starting point sf objects http://geocompr.robinlovelace.net/spatial-class.html and this on reading-in data (mentions gpx): http://geocompr.robinlovelace.net/read-write.html
Reproducible example showing how to load and create maps with gpx data from OSM:
library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.2.2, proj.4 4.9.2
download.file("https://www.openstreetmap.org/trace/1619756/data", "Sheff2leeds.gpx")
st_layers("Sheff2leeds.gpx")
#> Driver: GPX
#> Available layers:
#> layer_name geometry_type features fields
#> 1 waypoints Point 0 23
#> 2 routes Line String 0 12
#> 3 tracks Multi Line String 1 12
#> 4 route_points Point 0 25
#> 5 track_points Point 6085 26
route = st_read("Sheff2leeds.gpx", layer = "tracks")
#> Reading layer `tracks' from data source `/tmp/Rtmpb4EGb8/Sheff2leeds.gpx' using driver `GPX'
#> Simple feature collection with 1 feature and 12 fields
#> geometry type: MULTILINESTRING
#> dimension: XY
#> bbox: xmin: -1.50362 ymin: 53.40529 xmax: -1.411626 ymax: 53.65617
#> epsg (SRID): 4326
#> proj4string: +proj=longlat +datum=WGS84 +no_defs
plot(route)
#> Warning: plotting the first 9 out of 12 attributes; use max.plot = 12 to
#> plot all
# also try:
library(tmap)
qtm(route)
ttm()
#> tmap mode set to interactive viewing
qtm(route)
mapview::mapview(route)
is it possible to create maps in R based only on gps data (longitude and latitude) and one or two variables of interest ? when doing this tutorial, I wonder how can I generate all the extension files used like for the file "london_sport". I am just starting to use "creating maps function" in R. Thanks !