Skip to content

Is this package useful? #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bevingtona opened this issue Jan 24, 2022 · 0 comments
Open

Is this package useful? #15

bevingtona opened this issue Jan 24, 2022 · 0 comments

Comments

@bevingtona
Copy link
Collaborator

bevingtona commented Jan 24, 2022

Z values are already in the FWA, see example below.

Is this package still useful?

Some options:

  • User can select which elevation data to use: fwa or cded or srtm etc. ?
  • With a DEM, user can query elevation of a buffer region

To do:

  • Compare different methods
library(stars)
#> Loading required package: abind
#> Loading required package: sf
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1
library(bcmaps)
library(bcdata)
#> 
#> Attaching package: 'bcdata'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(sf)
library(tidyverse)

my_river <- bcdc_query_geodata("freshwater-atlas-rivers") %>%
  filter(GNIS_NAME_1 == "Parsnip River") %>%
  collect()

my_river_code <- unique(my_river$FWA_WATERSHED_CODE)

my_stream_network <- bcdc_query_geodata("freshwater-atlas-stream-network") %>%
  filter(FWA_WATERSHED_CODE == my_river_code) %>%
  collect()

my_stream_network <-
  my_stream_network %>%
  filter(BLUE_LINE_KEY == unique(my_stream_network$WATERSHED_KEY)) %>% st_as_sf()

p <- st_cast(my_stream_network, to = "POINT") %>% 
  select(geometry)
  
d <- p %>% 
  mutate(coords = st_coordinates(p)) %>% 
  mutate(X = coords[,"X"],
         Y = coords[,"Y"],
         Z = coords[,"Z"]) %>% 
  select(-coords) %>% 
  arrange(Z) %>% 
  mutate(dist_seg_m = replace_na(as.numeric(st_distance(geometry, lag(geometry), by_element = TRUE)),0),
         dist_tot_m = cumsum(dist_seg_m))

d %>% 
  ggplot() + 
  geom_point(aes(dist_tot_m/1000,Z,color=Z))

Created on 2022-01-23 by the reprex package (v2.0.1)

@bevingtona bevingtona changed the title Is this package useless? Is this package useful? Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant