Posted on June 29, 2011
SoilWeb is an interactive, multifaceted interface to USDA-NCSS soil survey information. Our SoilWeb application for Google Earth streams soil map units and point data as you navigate across the lower '48 states. Currently, our system imposes a 30,000 ac. limit (defined by the Google Earth viewport) for streaming detailed soil survey (SSURGO) map unit boundaries. This limit, combined with a 2 second delay before streaming is initiated, helps to reduce CPU load on our server. When viewing landscapes from directly overhead the 30,000 ac. limit is usually sufficient for most soils investigations. However, tilting the camera for oblique views of the landscape (an excellent way of visualizing soil-landscape relationships) causes the viewport to encompass much larger areas, usually exceeding SoilWeb's limit for detailed linework. The solution to this problem is summarized below, and can also be used to save "chunks" of detailed soil survey information for later use or offline browsing.
Posted on May 24, 2011
Quick post on terrain classification, based on some trouble folks were having with a previous example on Windows. With the spgrass6 package, raster stacks are created by loading several GRASS files at once:
x <- readRAST6(vname=c('beam_sum_mj','ned10m_ccurv','ned10m_pcurv','ned10m_slope')). This works well on UNIX-like operating systems and in cases where the entire collection of raster maps can fit within the system memory. A different strategy is needed when working with massive raster stacks or on other (less useful) operating systems. This post outlines one possible strategy that should work on massive data sets, and across operating systems.
- export terrain surfaces from GRASS to intermediate files
- import into R with raster package
- perform unsupervised classification on a sample of the cells using PAM
- apply clustering to unsampled cells with randomForest
- save results to intermediate file
- import results into GRASS for post-processing
Posted on May 9, 2011
The Wunderground.com website offers several creative interfaces to current and historic weather information. One of the more interesting features is the URL-based interface to personal weather stations. As far as I can tell, the Wunderground website only returns hourly data for a single day from personal weather stations... I wanted an entire year's worth of data, so it made sense to abstract the process of fetching a single day's worth of data from a named station into an R function. In this way, it is possible to quickly query the Wunderground website for arbitrary chunks of data. A semi-tested function, along with some examples are posted below. Enjoy!
Posted on April 30, 2011
Posted on April 18, 2011
Just got back from the 2011 GEOSTAT summer school that recently took place in Canberra, Australia. Thanks to Tom Hengl for the invitation to co-teach the course, to the great folks at ANU who made it possible, and to all of the students who participated. Most of the material from the class is available on the course website, including slides, R scripts, and other related demos. I have re-packaged some of my material on basic space/time analysis in R, and attached it to the bottom of this page. The self-contained demo includes in-line comments that closely follow the narrative from day 2 of the course. At some point I'll convert these examples into a proper web page... Enjoy!
Posted on March 28, 2011
This is a quick update to some code posted while back, related to plotting filled polygons within a lattice panel function. After attempting to use the originally described function to plot data with NA, I quickly realized that a more robust approach was required-- panel.polygon() does not deal well with missing data. A new function of the same name is attached at the bottom of the page, and some code demonstrating its use is presented below. The rle() function (run-length encoding) does most of the difficult work of identifying contiguous chunks of non-missing data. Each chunk is plotted as a separate polygon, resulting in a (mostly) generalized panel function for plotting filled polygons within the lattice framework. Comments welcome.
Posted on March 16, 2011
Working on some new ideas on how map unit data can be summarized on small screens-- particularly for our mobile version of SoilWeb. The distance from the nearest map unit polygon boundary is now printed above mini soil profile sketches. This gives the user a little more information that can be used to judge a relative degree of confidence in the returned soils data; the closer you are to the boundary the less likely you are actually standing in displayed map unit.
Here is an example:
Posted on March 8, 2011
Posted on February 28, 2011
The folks in Lincoln recently changed the links to the OSDs from http:// to https:// style URLs... which seems to cause problems for new versions of Google Earth. I have noticed that when clicking on soil profile sketches an error is returned (something about an SSL handshake problem). This can be fixed by asking Google Earth to use an external browser for displaying data. Here are some instructions:
Posted on December 15, 2010
I recently noticed the new latticeExtra page on R-forge, which contains many very interesting demos of new lattice-related functionality. There are strong opinions about the "best" graphics system in R (base graphics, grid graphics, lattice, ggplot, etc.)-- I tend to use base graphics for simple figures and lattice for depicting multivariate or structured data. The sp package defines classes for storing spatial data in R, and contains several useful plotting methods such as the lattice-based spplot(). This function, and back-end helper functions, provide a generalized framework for plotting many kinds of spatial data. However, sometimes with great abstraction comes great ambiguity-- many of the arguments that would otherwise allow fine tuning of the figure are buried in documentation for lattice functions. Examples are more fun than links to documentation, so I put together a couple of them below. They describe several strategies for placing and adjusting map legends-- either automatically, or manually added with the update() function. The last example demonstrates an approach for over-plotting 2 rasters. All of the examples are based on the meuse data set, from the gstat package.