Skip to content

Instantly share code, notes, and snippets.

# Copyright 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
library(rnaturalearth)
library(ggplot2)
library(sf)
country_poly <- ne_countries(scale = 50, returnclass = "sf")
res <- st_read("http://ihp-wins.unesco.org/geoserver/wfs?srsName=EPSG%3A4326&outputFormat=json&service=WFS&srs=EPSG%3A4326&request=GetFeature&typename=geonode%3Aworld_rivers&version=1.0.0&access_token=3165106ba28e11e997a3005056062634") %>%
library(sf)
library(dplyr)
library(bcdata)
get_bc_fsa <- function() {
x <- 'http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/2016/lfsa000b16a_e.zip'
temp_zip <- file.path(tempdir(), basename(x))
export_dir <- tempdir()
library(tidyverse)
library(bcmaps)
library(tmap)
library(sf)
library(rayshader)
library(raster)
ws <- wsc_drainages() %>%
filter(SUB_SUB_DRAINAGE_AREA_NAME %in% c("Quesnel", "Clearwater (B.C.)", "Lower Fraser - Williams Lake"))
library(tidyhydat)
library(dplyr)
library(purrr)
rl_stations <- realtime_stations(prov_terr_state_loc = "BC")
hy_stations <- hy_stations(prov_terr_state_loc = "BC")
## all stations that are both in hydat and have a realtime record
bc_stations <- rl_stations %>%
inner_join(hy_stations, by = "STATION_NUMBER")