dylan's blog

Generation of Sample Site Locations [sp package for R]

Submitted by dylan on Fri, 2008-08-15 04:56.

 
Premise
Setting up sampling designs is a non-trivial aspect to any field experiment that includes a spatial component. The sp package for R provides a simple framework for generating point sampling schemes based on region-defining features (lines or polygons) and a sampling type (regular spacing, non-aligned, random, random-stratified, hexagonal grid, etc.). The rgdal package provides a set of functions for importing/exporting common vector data formats. This example demonstrates simple import/export, iterating over sp objects, and reconstituting new objects from lists of objects. A more complex sampling scheme is demonstrated here.

Creating a Custom Panel Function (R - Lattice Graphics)

Submitted by dylan on Wed, 2008-07-30 01:51.

 
The Experiment
It was necessary (for the purposes of this exercise) to generate some grouped data worthy of a creative panel function. An experiment was designed to test the coordination of 4 individuals (each a panel in the figure below), as a function of "clarity of mind" (symbol color in the figure below). The actual details of the experiment can be deduced from the attached data file, and careful inspection of the resulting plot. A similar experiment was conducted some time ago to demonstrate the Spatstat package in R.

 
A Customized Panel Function for Lattice Graphics -- "panel.bulls_eye()"
Lattice graphics are one of several possible visualization methods in available in R that are most useful when working with grouped data. Plots are generated via a formula interface, often in the format of y ~ x | f -- where y is the dependent variable, x is the independent variable, and f is a grouping factor. Have a look at the attached file (bottom of page) for an example of data in this format. Each panel in the plot is generated by a panel function, using a subset of the original data as defined by the grouping variable. In most situations the standard panel functions, such as panel.xyplot, are sufficient. However, when working with more "interesting" data, a customized panel function is the way to go.

 
In order to try the sample code out, you will need to:

  1. install the required packages
  2. copy and paste the panel.bulls_eye function source into an R session
  3. download the sample data file
  4. run the code listed in the sample R session

 
Since panel functions are made to be generic, any data source that is similar in nature to the sample can be directly plotted using this code-- i.e. if the experiment were to be repeated using 8 subjects instead of 4. Enjoy.

( categories: )

Batch Projection and Masking with GRASS

Submitted by dylan on Wed, 2008-05-07 18:21.

 
Premise

Simple Python Interface to USGS TNM Elevation Service

Submitted by dylan on Tue, 2008-04-29 06:31.

 
Premise
Wanted a simpler way to access the USGS seamless elevation look-up service. Python seemed like a logical start. Note that the response from the USGS webservice is not correctly identified as valid XML by the python XML-parser. Therefore there is a small amount of scrubbing used to coerce the response into valid XML. Comments on why this is, or is not, a good idea are welcome.

 
Update It looks like the USGS service does not accept POST-style requests. I have made some small changes to the script below.

Streaming Soil Survey Data in Google Earth (updates)

Submitted by dylan on Thu, 2008-04-17 00:55.

STATSGO KML sample imageSTATSGO KML thumbnail

SSURGO KML ThumbnailSSURGO KML Thumbnail

A short update to a previous post on the visualization of NCSS/USDA soil survey data in Google Earth. The use of the NetworkLink construct, combined with the spatial indexing present in PostGIS, allows for very rapid lookup and presentation of this massive database. Scale-dependant switching between the detailed (SSURGO) and generalized (STATSGO) databases is done through simple area calculation in PostGIS.

Here is the link to the KMZ file. Here is a link to our conventional viewer application, based on Ka-Map / Mapserver, using the same PostGIS back-end (previous post on this). This PLSS KML file is very useful along-side soil survey information.

 
Feedback is always welcome!

Detailed Magnetic Declination

Submitted by dylan on Fri, 2008-03-14 20:45.

 
Premise:

Setting the magnetic declination on a compass is a critical step in accurate measurement of bearings that can be translated to map or survey. As the location of the magnetic north pole is constantly moving, the magnetic declination reported on older topographic maps or compass housings are probably out of date. Current declination values for a single point, or for large regions can be found on the NOAA sites:

These resources are helpful, but a current, detailed (state-level) map of magnetic declination would be interesting.

A need for data management courses in higher education

Submitted by dylan on Thu, 2008-01-17 00:00.

Working with large piles of complex data can be a difficult task, even for seasoned experts. What happens when a non-specialist is tasked with collecting, managing, and ultimately warehousing large amounts of painstakingly collected data? What happens when multiple non-specialists are concurrently working on these data? How can a revision history be maintained when a small set of files are being passed around via email, or appended to a "master" document?

( categories: )

Making better looking tables with \ctable

Submitted by dylan on Tue, 2007-12-18 00:42.

 
Premise:
The standard Latex table environment can be difficult to extend, especially when one wants to use modern constructs such as table foot notes, etc. The ctable package is a convenient approach to solving this problem. A complete worked example of a table typset using the \ctable command is presented below. Note that \ctable is a command, and therefore does not allow blank newline characters. One way to maintain readability is to trick Latex by adding a comment character to all blank lines. Link to PDF manual for ctable.

( categories: )

Some Notes on Compiling Applications Against GEOS 3.0.0rc4

Submitted by dylan on Tue, 2007-12-11 19:52.

I recently upgraded to GEOS 3.0.0rc4 in order to take advantage of its more robust handling of invalid geometries (damn shapefiles!). However, there are two mini-bugs in this release which need to be sorted out when compiling against it (or at least for the two application I was interested in: QGIS and StarSpan). Note that the first issue presented here has been resolved in GEOS 3.0.0rc5.