Learn R Programming

aqp (version 0.99-8.1)

mapunit_geom_by_ll_bbox: 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)

Value

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

Details

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

References

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

Examples

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

# basic usage
b <- c(-120.54,38.61,-120.41,38.70)
x <- mapunit_geom_by_ll_bbox(b) # about 20 seconds
plot(x)

# get map unit data for matching map unit keys
in.statement <- format_SQL_in_statement(unique(x$MUKEY))
q <- paste("SELECT mukey, muname FROM mapunit WHERE mukey IN ", in.statment, sep="")
res <- SDA_query(q)

Run the code above in your browser using DataLab