unionHUCSet: Union HUC Set

View source: R/unionHUCSet.R

unionHUCSetR Documentation

Union HUC Set

Description

Aggregates geometry for a large collection of HUCs. Note that subhucPoly must be all potential HUCs required.

Usage

unionHUCSet(aggrHUCs, fromHUCs, subhucPoly)

Arguments

aggrHUCs

The list of aggregate HUCs to be processed per HUC_aggregator

fromHUCs

The list of 'fromHUCs' to be processed per fromHUC_finder

subhucPoly

A subset of HUCs for the region in questioned.

Value

data.frame The subhucPoly data frame with requested aggregated HUCs unioned together. Note that Polygon 'ID's are set to the HUC id and areas are added up appropriately.

Author(s)

David Blodgett dblodgett@usgs.gov

Examples

## Not run: 
load(system.file("extdata","testhucpoly.rda",package="HUCAgg"))
plot(testhucPoly)
hucList<-testhucPoly@data$HUC12
fromHUC<-sapply(hucList,fromHUC_finder,hucs=testhucPoly@data$HUC12,tohucs=testhucPoly@data$TOHUC)
aggrHUCs<-sapply(hucList, HUC_aggregator, fromHUC=fromHUC)
testhucPoly<-unionHUCSet(aggrHUCs, fromHUC, testhucPoly)
plot(subset(testhucPoly,testhucPoly@data$HUC12 %in% "070900020904"), add=TRUE, col=rgb(1,0,0,.3))
plot(subset(testhucPoly,testhucPoly@data$HUC12 %in% "070900020702"), add=TRUE, col=rgb(1,1,0,.3))

## End(Not run)

USGS-R/HUCAgg documentation built on Nov. 24, 2022, 4:36 a.m.