-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.Rmd
More file actions
100 lines (73 loc) · 2.36 KB
/
README.Rmd
File metadata and controls
100 lines (73 loc) · 2.36 KB
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
---
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%",
warning = FALSE
)
```
<!-- badges: start -->
[](https://choosealicense.com/licenses/apache-2.0/)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](#)
[](https://github.com/mikejohnson51/hfutils/actions/workflows/pkgdown.yaml)
<!-- badges: end -->
# Hydrofabric Utilities
`hfutils` provides the base utilities needed for hydrofabric I/O + navigation; geometry modification + cleaning; and authentication to the Lynker Spatial cloud. Collectively, it provides the building blocks from which reference fabrics and geoprocessed fabrics can be created.
## Installation
You can install the development version of `hfutils` from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("lynker-spatial/hfutils")
```
```{r,message=FALSE}
library(hfutils)
library(dplyr)
```
## Basic Use
### I/O
#### Basic connection: Dataset
```{r, eval = TRUE}
gpkg <- '/Users/mikejohnson/hydrofabric/v3.0/reference_fabric.gpkg'
hfutils::as_ogr(gpkg)
```
#### Basic connection: Layer
```{r, eval = TRUE}
hfutils::as_ogr(gpkg, "divides")
```
#### Lazy Eval
```{r, eval = TRUE}
hfutils::as_ogr(gpkg, "divides") |>
select(divide_id, areasqkm)
```
#### sf extraction
```{r, eval = TRUE}
hfutils::as_ogr(gpkg, "divides") |>
filter(vpuid == "01") |>
st_as_sf()
```
### Network Properties
```{r}
## Accumulate Downstream
system.time({
da <- hfutils::as_ogr(gpkg, 'flowpaths') |>
filter(vpuid == "01") |>
st_as_sf() |>
accumulate_downstream(attr = "areasqkm")})
head(da)
## Hydrosequence
system.time({
hs <- hfutils::as_ogr(gpkg, 'flowpaths') |>
filter(vpuid == "01") |>
st_as_sf() |>
get_hydroseq()
})
head(hs)
```
### Questions?
Please reach out via an issue or PR if you have comments, concerns, or questions!