knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(ggplot2)
library(sf)
library(fwapgr)

fwapgr

Lifecycle: stable R-CMD-check Codecov test coverage License: MIT

fwapgr is an R package that uses the fwapg API to query the Freshwater Atlas (FWA) of British Columbia (BC). The functions and arguments in fwapgr match those available in the API.

If you are looking for a higher-level R package to query the FWA of BC see fwatlasbc which wraps fwapgr.

Installation

To install the lastest version from GitHub

# install.packages("devtools")
devtools::install_github("poissonconsulting/pgfeatureserv")
devtools::install_github("poissonconsulting/fwapgr")

Introduction

fwapgr allows you to perform three types of operation.

Get Information on Collections

Get information about the collections or a collection's properties:

Query a Collection

Query features from a collection:

Execute Spatial Functions

Execute spatial functions:

Demonstration

Get Sangan River from whse_basemapping.fwa_stream_networks_sp collection:

coll <- "whse_basemapping.fwa_stream_networks_sp"
river <- fwapgr::fwa_query_collection(coll, filter = list(gnis_name = "Sangan River"))
river

Get simplified Yakoun River watershed starting 10km upstream:

blk <- river$blue_line_key[1]
wshed <- fwapgr::fwa_watershed_at_measure(
  blk,
  downstream_route_measure = 10000,
  transform = c("ST_Simplify", 2000)
)
ggplot2::ggplot() +
  ggplot2::geom_sf(data = wshed, lwd = 0.15, fill = "steelblue", alpha = 0.5) +
  ggplot2::geom_sf(data = river, lwd = 0.15)

Creditation

fwapgr relies on fwapg API which is created, maintained and hosted by Simon Norris at Hillcrest Geographics.

Contribution

Please report any issues.

Pull requests are always welcome.

Code of Conduct

Please note that fwapgr is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



poissonconsulting/fwapgr documentation built on March 30, 2024, 1:51 a.m.