mapunit_geom_by_ll_bbox: Fetch Map Unit Geometry from SDA

Description Usage Arguments Details Value Note Author(s) References Examples

Description

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

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# fetch map unit geometry from a bounding-box:
# 
#         +------------- (-120.41, 38.70)
#         |                     |
#         |                     |
# (-120.54, 38.61) --------------+

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

# note that the returned geometry is everything overlapping the bbox
# and not an intersection... why?
plot(x)
rect(b[1], b[2], b[3], b[4], border='red', lwd=2)


# 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.statement, sep="")
res <- SDA_query(q)

## End(Not run)

soilDB documentation built on May 2, 2019, 5:17 p.m.