Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/poissonconsulting/fwapgr
An R Client for BC Freshwater Atlas Web API
https://github.com/poissonconsulting/fwapgr
bc freshwater-atlas fwapg r
Last synced: about 1 month ago
JSON representation
An R Client for BC Freshwater Atlas Web API
- Host: GitHub
- URL: https://github.com/poissonconsulting/fwapgr
- Owner: poissonconsulting
- License: other
- Created: 2020-05-12T17:30:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-25T23:50:27.000Z (10 months ago)
- Last Synced: 2024-03-26T00:35:14.797Z (10 months ago)
- Topics: bc, freshwater-atlas, fwapg, r
- Language: R
- Homepage: https://poissonconsulting.github.io/fwapgr
- Size: 22.7 MB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(ggplot2)
library(sf)
library(fwapgr)
```# fwapgr
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![R-CMD-check](https://github.com/poissonconsulting/fwapgr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/poissonconsulting/fwapgr/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/poissonconsulting/fwapgr/branch/master/graph/badge.svg)](https://codecov.io/gh/poissonconsulting/fwapgr?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit/)`fwapgr` is an R package that uses the [fwapg API](https://features.hillcrestgeo.ca/fwa/index.html) to query the [Freshwater Atlas](https://www2.gov.bc.ca/gov/content/data/geographic-data-services/topographic-data/freshwater) (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`](https://github.com/poissonconsulting/fwatlasbc) which wraps `fwapgr`.
## Installation
To install the lastest version from [GitHub](https://github.com/poissonconsulting/fwapgr)
```{r, eval=FALSE}
# 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](https://features.hillcrestgeo.ca/fwa/collections.html) or a collection's properties:
* [`fwa_collections()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_collections.html)
* [`fwa_collection_properties()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_collection_properties.html)### Query a Collection
Query features from a [collection](https://features.hillcrestgeo.ca/fwa/collections.html):
* [`fwa_query_collection()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_query_collection.html)
### Execute Spatial Functions
Execute spatial [functions](https://features.hillcrestgeo.ca/fwa/functions.html):
* [`fwa_index_point()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_index_point.html)
* [`fwa_locate_along()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_locate_along.html)
* [`fwa_locate_along_interval()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_locate_along_interval.html)
* [`fwa_watershed_at_measure()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_watershed_at_measure.html)
* [`fwa_watershed_hex()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_watershed_hex.html)
* [`fwa_watershed_stream()`](https://poissonconsulting.github.io/fwapgr/reference/fwa_watershed_stream.html)
* [`hydroshed()`](https://poissonconsulting.github.io/fwapgr/reference/hydroshed.html)## Demonstration
Get Sangan River from `whse_basemapping.fwa_stream_networks_sp` collection:
```{r}
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:
```{r}
blk <- river$blue_line_key[1]
wshed <- fwapgr::fwa_watershed_at_measure(
blk,
downstream_route_measure = 10000,
transform = c("ST_Simplify", 2000)
)
``````{r dpi=300, fig.width=7, fig.height=7}
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](https://features.hillcrestgeo.ca/fwa/index.html) which is created, maintained and hosted by [Simon Norris](https://github.com/smnorris/fwapg) at [Hillcrest Geographics](https://hillcrestgeo.ca/).
## Contribution
Please report any [issues](https://github.com/poissonconsulting/fwapgr/issues).
[Pull requests](https://github.com/poissonconsulting/fwapgr/pulls) are always welcome.
### Code of Conduct
Please note that `fwapgr` is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.