Site icon R-bloggers

OSM Guadeloupe trail relation

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Guadeloupe – CC-BY-SA by SnippyHolloW

Day 2 of 30DayMapChallenge: « Lines » (previously).

Using data from Openstreetmap we will map the GR G1 trail (fr) crossing Guadeloupe. We could use {osmdata} (see this post), but in this case it’s easier to just grab a GPX file from Waymarked Trail (see the link in lower right corner).

library(sf)
library(tidyverse)
library(leaflet)

st_layers("https://hiking.waymarkedtrails.org/api/v1/details/relation/10692471/geometry/gpx")
Driver: GPX 
Available layers:
    layer_name     geometry_type features fields crs_name
1    waypoints             Point        0     23   WGS 84
2       routes       Line String        0     12   WGS 84
3       tracks Multi Line String        1     12   WGS 84
4 route_points             Point        0     25   WGS 84
5 track_points             Point     3673     26   WGS 84
gr <- read_sf("https://hiking.waymarkedtrails.org/api/v1/details/relation/10692471/geometry/gpx",
              layer = "tracks")
# Map
leaflet(gr) |> 
  addPolylines() |> 
  addTiles()
Figure 1: GR G1 in Guadeloupe
< !-- -->
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version