Open dasom1348 opened 6 years ago
library(tidyverse) library(macleish)
=======
devtools::install_github("beanumber/macleish")
1bb2015a5e6b02c15658c91f5ffd291063fc8dc4
library(tidyverse) library(macleish) library (dplyr) <<<<<<< HEAD
ca8071ab7d9b03cb0d8859eb10adfe7e84ab723b library(sf) library(sf) library(lwgeom)
library(sf) library(lwgeom)
>>>>>>> 1bb2015a5e6b02c15658c91f5ffd291063fc8dc4 trails <- macleish_layers[["trails"]] %>% mutate(computed_length = st_length(geometry)) macleish_layers[["trails"]] head(trails) plot(macleish_layers[["trails"]]) trails_1<- trails %>% group_by(name) %>% summarize(num_segments = n(), total_length = sum(computed_length)) %>% arrange(desc(total_length)) %>% mutate(Difficulty = if_else(total_length<1000, "Easy", ifelse(total_length <2000, "Moderate", "Hard"))) library(units) as.vector(trails_1) View (trails) View(trails) >>>>>>> 1bb2015a5e6b02c15658c91f5ffd291063fc8dc4
#elevation elevation <- st_read("CONTOURS250K_ARC.shp") names(macleish_layers) contours <- macleish_layers[["contours_3m"]] %>% dplyr::select(ELEV_M, ELEV_FT, INDEX_ARC, SHAPE_LEN, geometry) elevation_trail_xings <- macleish_layers[["trails"]] %>% st_intersection(macleish_layers[["contours_3m"]]) %>% dplyr::select(ELEV_M, ELEV_FT, INDEX_ARC, SHAPE_LEN, geometry, name, color) %>% dplyr::group_by(name) %>% dplyr::summarise(max = max(ELEV_FT), min = min(ELEV_FT), n = n()) %>% dplyr::mutate(difference = max - min) %>% dplyr::mutate(Difficulty = if_else(difference < 100, "Easy", ifelse(difference < 200, "Moderate", "Hard"))) library(leaflet) leaflet() %>% addTiles() %>% addPolylines(data = trails_1) plot(elevation_trail_xings) #the_crs <- crs(trails, asText = TRUE) #st_crs(elevation) #st_crs(trails) <<<<<<< HEAD st_crs(elevation) st_crs(trails) #library(sf) <<<<<<< HEAD ======= library(raster) >>>>>>> 1bb2015a5e6b02c15658c91f5ffd291063fc8dc4 the_crs <- crs(trails, asText = TRUE) elevation_crs <- st_transform(trails, crs = the_crs) ======= #View(contours) >>>>>>> 64c3bb02d8878e34e88729efc2dc0846c5bfbb73
<<<<<<< HEAD Data for elevation: http://maps-massgis.opendata.arcgis.com/datasets/84ecbf026489446c8562df038c352772_0 http://download.massgis.digital.mass.gov/shapefiles/state/contours250k.zip
##source data url <- "http://download.massgis.digital.mass.gov/shapefiles/state/contours250k.zip" local_file <- basename(url) download.file(url, destfile = local_file) <<<<<<< HEAD unzip(local_file, exdir = "elevation")
dim(elevation) packageVersion("macleish") names(macleish_layers)
======= unzip(local_file, exdir = "contours250k")
======= >>>>>>> 1bb2015a5e6b02c15658c91f5ffd291063fc8dc4 ```{r fig.show="hold", fig.width=3} #put all the figures together
ca8071ab7d9b03cb0d8859eb10adfe7e84ab723b
library(tidyverse) library(macleish)
Install macleish
devtools::install_github("beanumber/macleish")
=======
Install macleish
devtools::install_github("beanumber/macleish")
library(tidyverse) library(macleish) library (dplyr) <<<<<<< HEAD
<<<<<<< HEAD Data for elevation: http://maps-massgis.opendata.arcgis.com/datasets/84ecbf026489446c8562df038c352772_0 http://download.massgis.digital.mass.gov/shapefiles/state/contours250k.zip
======= unzip(local_file, exdir = "contours250k")