R client for the Global Lakes and Wetlands Database
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
man
tests
vignettes
.Rbuildignore
DESCRIPTION
NAMESPACE
README.Rmd
README.md
glwdr.Rproj

README.md

Global Lakes and Wetlands Database (GLWD) R client

Project Status: Active - The project has reached a stable, usable state and is being actively developed. rstudio mirror downloads cran version

Installation

devtools::install_github("jsta/glwdr")

Load Package

library(glwdr)

Usage

Level 1

glwd_get(level = 1)

dt <- glwd_load(level = 1)
library(maps)
library(sp)

dt <- dt[dt$COUNTRY == "United States" &
         dt$LAT_DEG < 56 &
         dt$AREA_SKM < 30000,] 
 
map("state")
plot(dt, add = TRUE, col = "blue")
axis(1); axis(2)

Level 2

glwd_get(level = 2)

dt <- glwd_load(level = 2)
library(ggplot2)
library(raster)

states <- map_data("state")
states <- glwdr:::map_data_to_spdf(states)
projection(dt) <- projection(states)

map("state")
plot(dt[states,], add = TRUE, border = "blue")
axis(1); axis(2)

Level 3

glwd_get(level = 3)

dt <- glwd_load(level = 3)
map("world")
plot(dt, breaks = 1:12, col = viridis::viridis(12), add = TRUE)
axis(1); axis(2)

References

Lehner, B., Döll, P.: Development and validation of a global database of lakes, reservoirs and wetlands, Journal of Hydrology, Volume 296, Issues 1–4, 20 August 2004, Pages 1-22, http://dx.doi.org/10.1016/j.jhydrol.2004.03.028.