-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
97 lines (67 loc) · 2.73 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# LAGOSUSgis
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental) [![CRAN status](https://www.r-pkg.org/badges/version/LAGOSUSgis)](https://cran.r-project.org/package=LAGOSUSgis) [![DOI](https://zenodo.org/badge/106293356.svg)](https://zenodo.org/badge/latestdoi/106293356)
Extra functions to interact with the GIS module of LAGOSUS.
## Features
* **Easy**: Convenience functions allow for straight-forward subsetting.
* **Fast**: Queries are optimized for speed to avoid loading the entirety of massive layers.
* **Flexible** : Custom queries can be constructed using `SQL` statements.
## Installation
```{r eval=FALSE}
remotes::install_github("cont-limno/LAGOSUSgis")
```
## Usage
```{r eval=FALSE}
library(LAGOSUSgis)
```
### Download data
```{r eval=FALSE, echo=FALSE}
# lagosusgis_get()
```
Until data is posted publicly, place the `LAGOSUSgis` geodatabase file in the location returned by `lagosusgis_path()`
### List available GIS layers
```{r eval=FALSE}
library(sf)
sf::st_layers(LAGOSUSgis::lagosusgis_path())
```
```{r eval = TRUE, echo=FALSE}
library(details)
ly <- sf::st_layers(LAGOSUSgis:::lagosusgis_path())
details(
knitr::kable(data.frame(ly[c("name", "driver", "features", "fields")])),
summary = "layers")
```
### Query a lake polygon
```{r eval=FALSE}
res_lake <- query_lake_poly(34352)
```
### Query from a specfic layer
```{r eval=FALSE}
res_iws <- query_gis(layer = "ws",
id_name = "lagoslakeid", ids = c(34352))
res_lake <- query_gis(layer = "LAGOS_US_All_Lakes_1ha",
id_name = "lagoslakeid", ids = 34352)
res_pnt <- query_gis(layer = "LAGOS_US_All_Lakes_1ha_POINTS",
id_name = "lagoslakeid", ids = 34352)
```
### Query a combined watershed and lake polygon
```{r eval=FALSE}
res <- query_wbd(lagoslakeid = c(7010))
```
### Flexible queries using `SQL` statements
```{r eval=FALSE}
res <- query_gis_(query = "SELECT * FROM ws WHERE lagoslakeid IN ('7010')")
res <- query_gis_(query = paste0("SELECT * FROM LAGOS_US_All_Lakes_1ha_points WHERE lake_centroidstate LIKE '", "RI", "' AND lake_totalarea_ha > 4"))
```
## References
Soranno P., K. Cheruvelil. 2017. LAGOS-NE-GIS v1.0: A module for LAGOS-NE, a multi-scaled geospatial and temporal database of lake ecological context and water quality for thousands of U.S. Lakes: 2013-1925. Environmental Data Initiative. http://dx.doi.org/10.6073/pasta/fb4f5687339bec467ce0ed1ea0b5f0ca. Dataset accessed 9/26/2017.