# Archive for January, 2011

## Landscape Position and McNab Indices (cont.)

Posted by smathermather on January 30, 2011

I typed that last one too quickly– too many typos, but my wife says I’m not supposed to revise blogs, but move on… .

So, for clarity, let’s talk a little more about McNab indices.  Field-derived McNab indices are a measure of average angle from the observer to the horizon (mesoscale landform index), or from the observer to another field person a set distance away, e.g. 10m or 18m, or whatever the plot size or settled upon (minor landform index).  Typically these are done in the field at a discreet number of directions, e.g. 4 cardinal directions, or 4 cardinal plus 4 ordinal (NE,NW SE, SW, SE) directions. The landform image in this post and the last is a calculation of mesoscale landform, which is harder to do in a classic GIS than minor landform (I’ll have a follow-up post on minor landform, probably using ArcGIS).

To calculate the values for mesoscale landform computationally, we require calculating the angle to the horizon for a certain number of directions for each point in the landscape.  This has the potential to be computationally intensive and complicated.  If, however, we conceive of the problem differently, as a 3D calculation we can perform in PovRay, arriving at the answer is simplified by the coding already done by the PovRay programmers.

Essentially, McNab mesoscale indices are a field proxy for the steradian of a site.

What does that mean?  Well, essentially, a map of steradians is a proxy for the shading of a white uneven surface on a cloudy day– or how much diffuse light is available to a given site.  Used in combination with site aspect, this is enough information to determine most of of the light conditions of a site, which is why McNab indices in combination with other factors are a good predictor of site productivity, and correlated with different plant communities across the landscape.

How does an uneven white surface shade on a cloudy day? Steeper areas with more of the sky occluded are darker while wide open spaces, like the bottom of river valleys and the tops of ridges and plateaus are brighter.  If you want to witness this effect, look to snow on the ground on a cloudy day (and what a great winter to do it).  (The only difference with snow is subsurface scattering which evens out the light quite a bit.)  You’ll notice the divots in the snow to be darker than the peaks, and the edges of the divots to be darkest of all.

The question then, is how to we compute this within PovRay?  We could use radiance as a global illumination model, but the calculation of inter-reflectivity that is at the core of radiance, while an important real factor in the landscape, would fail to replicate the original mesoscale landform index.  Instead, we set up a series of lights in a dome to illuminate the whole sky sphere, blur them a bit, and call it a day, a technique developed for HDRI rendering by Ben Weston, whose code I borrowed heavily.  The more lights the element of the landscape is exposed to the brighter, and vice versa, essentially making the brightness of an element proportional to the exposure to the sky sphere.  Unlike Ben, I used a simple white sphere to get even lighting.

Rendered at 16-bit resolution, we have a possible range of values from 0-65535.  Let’s assume that a linear transformation of these values will result in values representing the proportion of the sky sphere.  From there, transformation to steradians and then to solid angles in degrees is trivial.  Once it’s solid angles in degrees, it represents the same kind of value as a mesoscale landform index would give us (more later…).

## Landscape Position and McNab Indices

Posted by smathermather on January 29, 2011

Just a quick teaser post for our forestry/ecology readers out there.  I have a methodology developed for calculating McNab indices that directly corresponds with the field technique (unlike, as far as I know, any previous GIS-based techniques– which are probably adequate proxies).

What is a McNab index?  Well there are two kinds, the minor landforms and mesoscale landforms that are field-measured topographic position or terrain shape indices inform the location of ecological processes across the landscape.  So, for example, some plant forest types like ridges, and some like ravines.  The question is, quantitatively, how raviney or ridgey should it be for a given species, association, or alliance, and how is it measured?  Basically either average angle to horizon, or average angle to the local landscape, e.g. 10m away are the two McNab indices.  See i.e. http://www.treesearch.fs.fed.us/pubs/1150 and http://www.treesearch.fs.fed.us/pubs/24472.

So here’s the output (more to come), including code.  The darker the shade, the lower the relative position, the lighter the shade, the higher the valley, e.g. ridges and planes.  I know, it just looks like a hillshade, but there’s deeper stuff happening here:

## Debian Configuration– Tomcat on Boot

Posted by smathermather on January 24, 2011

Start-up scripts in Debian Linux aren’t exactly straight forward for the un-initiated.  Actually, if memory serves me, they aren’t any more straight forward on Ubuntu Linux either, but such is heredity.

We are transitioning some of our GeoServer instances over to 64-bit Debian Linux.  In my test Ubuntu environment, I had a hack in place to force the Tomcat Java Servlet to launch on startup, but it was a hack and not very deep in understanding.  Here, I will go somewhat deeper.

So, why not just use a package manager to install Tomcat, thus bi-passing the need for setting up my own service?  GeoWebCache’s configuration guide discouraged me:

Due to licensing issues, many Linux distributions come with a variety of Java environments. Additionally, to minimize the chance of a security breach with default settings, most versions of Tomcat are configured to not allow access to the file system. Therefore, it is highly recommended to follow these instructions, even if you already have a servlet container set up.

Well, ok then.  I’ll roll my own.

Following the installation instructions for GeoWebCache is straightforward, but I have no interest in starting Tomcat manually, except when necessary.

I modified code from this source:

http://linux.derkeiler.com/Mailing-Lists/Debian/2008-12/msg00099.html

to get something that looks like this as my script to run a Tomcat6 startup shell:

#!/bin/sh
# /etc/init.d/tomcat6: start Tomcat6 server.

test -f /opt/apache-tomcat-6.0.30/bin/startup.sh || exit 0

case "\$1" in

start) export JAVA_HOME=/opt/jre1.6.0_23/bin/
logger -t Tomcat6 "Starting Tomcat 6..."
exec /opt/apache-tomcat-6.0.30/bin/startup.sh | logger -t Tomcat6
;;

stop) export JAVA_HOME=/opt/jre1.6.0_23/bin/
logger -t Tomcat6 "Shutting down Tomcat 6..."
exec /opt/apache-tomcat-6.0.30/bin/shutdown.sh | logger -t Tomcat6
;;

*) echo "Usage: /etc/init.d/tomcat6 {start|stop}"
exit 2
;;
esac
exit 0

I still need to deploy this as a service. The first step is to sudo or su root and place this in my /etc/init.d directory.

sudo cp tomcat6.sh /etc/init.d/.

Now this needs loaded as a service.  Normal multi-user run levels for debian are 2-5.  0, 1 and 6 are “System Halt”, “Single User Mode”, and Reboot, so we set the start flag to run on multi-user logins, and to stop in the other run levels, like reboot.

update-rc.d apache2 start 99 2 3 4 5 . stop 99 0 1 6 .

Ah, now it works a charm.  FYI, I did my testing of the script while logged in as root, so I wouldn’t have to restart with every change.  I figured being logged in as root would simulate, pretty closely, the boot environment, relative to being an ordinary user.

Posted in Other | Tagged: , , , , , , | 3 Comments »

## Garmin Custom Maps

Posted by smathermather on January 11, 2011

I don’t spend much time on field equipment, e.g. GPS units.  Why?  Lack of interest?  No.  Lack of space in my job description.  Yes, I know.  A GIS Manager who doesn’t have a GPS is it’s own category of silly.  None-the-less, when a colleague told me that Garmin now has firmware support for custom maps for some of it’s GPS units, I told him it might be a good choice for his field work and that I’d work on loading our maps onto his unit when it came in.

Sure enough, it came in, and we’ve loaded them.  You can follow Garmin’s directions, but if you already have georeferenced data, skip them and by whatever means you know, generate a jpeg with a world file (for you ArcMap users, goto data view, file:export choose jpeg, and check the world file checkbox).  You can export an image from any desktop or server package, and if you know the upper left coordinate of the image, and the pixel size, you have enough to create a world file.  Easiest hand crafting of geographic data you can imagine (it’s the gateway for bigger and better hand crafted geographic data).

Now, you can use MapTiler to generate the kind of KMZ that is so near and dear to the garmin’s heart.  Just choose KMZ as your output type, choose one of the garmin types in the next screen, and the rest easy easy GUI fun.

Limitations:

Well, Garmin doesn’t want you to load more than 100 tiles (probably for performance reasons), but what does that mean practically?  For the testing I did, that meant for a 4 foot pixel (most of our best data isn’t more spatially accurate than that, even if it’s more precise), I was able to load about 3200 acres– enough for one of our larger parks.  Good enough for our work, but you might consider a deeper tool if you need more raster data than that at a time.

Posted in Uncategorized | Tagged: , , , , | 3 Comments »

## 2010 in review– Easy Squeezy Blog post (since I didn’t write it).

Posted by smathermather on January 2, 2011

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

The Blog-Health-o-Meter™ reads Fresher than ever.

## Crunchy numbers

A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 6,100 times in 2010. That’s about 15 full 747s.

In 2010, there were 29 new posts, growing the total archive of this blog to 57 posts. There were 63 pictures uploaded, taking up a total of 22mb. That’s about 1 pictures per week.

The busiest day of the year was November 11th with 68 views. The most popular post that day was PostGIS and LiDAR, the saga completes?.

## Where did they come from?

The top referring sites in 2010 were en.wordpress.com, geovisualization.wordpress.com, oslandia.com, google.com, and perrygeo.net.

Some visitors came searching, mostly for topographic position index, gdal dem, postgis lidar, postgis using st_difference, and postgis cluster.

## Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

PostGIS and LiDAR, the saga completes? April 2010
1 comment

2

LiDAR processing and analysis in PostGIS (I hope…). January 2010