Read files in, and split into path and collection points Run some simple stats on collection points Project the data Create a 25 m corridor around the path Are there collection points outside that corridor? If so create 10 meter circles around them, and do a union with corridor Create a 5 m grid in the area Using 20 m mean filter, populate grid Contour and plot
# Read in the filesgpx_parsed <- XML::htmlTreeParse(file =paste0(path, "20240620.gpx"), useInternalNodes =TRUE)coords <- XML::xpathSApply(doc = gpx_parsed, path ="//trkpt", fun = XML::xmlAttrs)ways <- XML::xpathSApply(doc = gpx_parsed, path ="//wpt", fun = XML::xmlAttrs)wpt_type <- XML::xpathSApply(doc = gpx_parsed, path ="//wpt/name", fun = XML::xmlValue)elevation <- XML::xpathSApply(doc = gpx_parsed, path ="//wpt/ele", fun = XML::xmlValue)# elevation <- XML::xpathSApply(doc = gpx_parsed, path = "//trkpt/ele", fun = XML::xmlValue)df <-data.frame(lat =as.numeric(ways["lat", ]),lon =as.numeric(ways["lon", ]),waypt = wpt_type,elevation =as.numeric(elevation))
plot it
library(leaflet)leaflet() %>%addTiles() %>%addPolylines(data = df, lat =~lat, lng =~lon, color ="#000000", opacity =0.8, weight =3) %>%addMarkers(data=df, lat =~lat, lng =~lon )
Better plot
df2 <- df %>% sf::st_as_sf(., coords=c("lon","lat"),crs=4326)tmap::tmap_options(basemaps="OpenStreetMap")tmap::tmap_mode("view") # set mode to interactive plots