mapunit_geom_by_ll_bbox {soilDB}R Documentation

Fetch Map Unit Geometry from SDA

Description

Fetch map unit geometry from the SDA website by WGS84 bounding box.

Usage

mapunit_geom_by_ll_bbox(bbox, source = 'sda')

Arguments

bbox

a bounding box in WGS coordinates

source

the source database, currently limited to soil data access (SDA)

Details

The SDA website can be found at http://sdmdataaccess.nrcs.usda.gov. See examples for bounding box formatting.

Value

A SpatialPolygonsDataFrame of map unit polygons, in WGS84 (long,lat) coordinates.

Note

It appears that SDA does not actually return the spatial intersecion of map unit polygons and bounding box. Rather, just those polygons that are completely within the bounding box / overlap with the bbox. This function requires the 'rgdal' (http://cran.r-project.org/package=rgdal) package.

Author(s)

Dylan E Beaudette

References

http://casoilresource.lawr.ucdavis.edu/

Examples

# fetch map unit geometry from a bounding-box:
# 
#         +------------- (-120.41, 38.70)
#         |                     |
#         |                     |
# (-120.54, 38.61) --------------+

## Not run: 
##D # basic usage
##D b <- c(-120.54,38.61,-120.41,38.70)
##D x <- mapunit_geom_by_ll_bbox(b) # about 20 seconds
##D 
##D # note that the returned geometry is everything overlapping the bbox
##D # and not an intersection... why?
##D plot(x)
##D rect(b[1], b[2], b[3], b[4], border='red', lwd=2)
##D 
##D 
##D # get map unit data for matching map unit keys
##D in.statement <- format_SQL_in_statement(unique(x$MUKEY))
##D q <- paste("SELECT mukey, muname FROM mapunit WHERE mukey IN ", in.statement, sep="")
##D res <- SDA_query(q)
## End(Not run)

[Package soilDB version 1.6.3 Index]