diff --git a/README.Rmd b/README.Rmd index 8501064..aba18cd 100644 --- a/README.Rmd +++ b/README.Rmd @@ -9,8 +9,10 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", - out.width = "100%" + out.width = "100%", + warning = FALSE ) +gpkg = '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg' ``` # hfsubsetR @@ -29,7 +31,50 @@ The goal of `hfsubsetR` is to extract hydrofabric subsets from cloud or local ar You can install the development version of `hfsubsetR` from [GitHub](https://github.com/) with: ``` r -# install.packages("devtools") -devtools::install_github("lynker-spatial/hfsubsetR") +# install.packages("remotes") +remotes::install_github("lynker-spatial/hfsubsetR") ``` +```{r} +library(hfsubsetR) +``` +## Basic Use + +### From local file + +We can download a version (default = '2.2') hydrofabric (default = 'nextgen') for any domain (default = 'conus') using `get_hydrofabric`. + +```{r, eval = FALSE} +gpkg <- '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg' + +get_hydrofabric(outfile = gpkg) +``` +From that, we can extract data for a VPU: + +```{r, eval = FALSE} +get_vpu_fabric(gpkg, + vpuid = "01", + outfile = '/Users/mikejohnson/hydrofabric/01_nextgen.gpkg') +``` + +Or, we can extract a subset based on an input identifier (one of `id`, `comid`, `hl_uri`, `poi_id`, `nldi_feature`, `xy`): + +```{r} +subset_fabric <- get_subset(gpkg = gpkg, comid = 101) +``` + +```{r, echo = FALSE} +{ + plot(subset_fabric$divides$geom, col = "gray90") + plot(subset_fabric$flowpaths$geom, add = TRUE, col = "blue") + plot(subset_fabric$nexus, add = TRUE, col = "red", pch = 16) +} +``` + +### From Remote + +Coming soon... + +### Questions? + +Please reach out via an issue or PR if you have comments, concerns, or questions! diff --git a/README.md b/README.md index 6a0f155..5899249 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,49 @@ You can install the development version of `hfsubsetR` from [GitHub](https://github.com/) with: ``` r -# install.packages("devtools") -devtools::install_github("lynker-spatial/hfsubsetR") +# install.packages("remotes") +remotes::install_github("lynker-spatial/hfsubsetR") ``` + +``` r +library(hfsubsetR) +``` + +## Basic Use + +### From local file + +We can download a version (default = ‘2.2’) hydrofabric (default = +‘nextgen’) for any domain (default = ‘conus’) using `get_hydrofabric`. + +``` r +gpkg <- '/Users/mikejohnson/hydrofabric/conus_nextgen.gpkg' + +get_hydrofabric(outfile = gpkg) +``` + +From that, we can extract data for a VPU: + +``` r +get_vpu_fabric(gpkg, + vpuid = "01", + outfile = '/Users/mikejohnson/hydrofabric/01_nextgen.gpkg') +``` + +Or, we can extract a subset based on an input identifier (one of `id`, +`comid`, `hl_uri`, `poi_id`, `nldi_feature`, `xy`): + +``` r +subset_fabric <- get_subset(gpkg = gpkg, comid = 101) +``` + + + +### From Remote + +Coming soon… + +### Questions? + +Please reach out via an issue or PR if you have comments, concerns, or +questions! diff --git a/man/figures/README-unnamed-chunk-6-1.png b/man/figures/README-unnamed-chunk-6-1.png new file mode 100644 index 0000000..646770f Binary files /dev/null and b/man/figures/README-unnamed-chunk-6-1.png differ