-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
110 lines (79 loc) · 4.54 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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 <img src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[![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/)
<!-- badges: end -->
`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.