# Arne 2019

```{r, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
```

## Loading the waypoints


```{r}
library(mapview)
library(sf)
library(dplyr)
library(giscourse)
path<-"/home/arne"
a<-dir(path,pattern="gpx")
a<-sprintf('%s/%s',path,a)


f<-function(x){
  d<-st_read(x,layer = "waypoints")
  d$group<-x
  d
  }

d<- do.call("rbind",lapply(a,f))

d %>% select(c("name", "group","time")) ->d

mapview(d, zcol='group',burst=TRUE, legend=FALSE) ->mp

mp@map %>% leaflet.extras::addFullscreenControl()

```



```{r}
coords<-st_coordinates(d)
clus<-hclust(dist(coords))
plot(clus)

```


```{r}
d$site<-as.factor(cutree(clus,2))

mapview(d, zcol='site',burst=TRUE, legend=FALSE) ->mp

mp@map %>% leaflet.extras::addFullscreenControl()


```

