----r-sig-geo-bounces@stat.math.ethz.ch wrote: -----
To: r-sig-geo@stat.math.ethz.ch
From: Colin Beale <c.beale@macaulay.ac.uk>
Sent by: r-sig-geo-bounces@stat.math.ethz.ch
Date: 31.01.2006 08:20
Subject: [R-sig-Geo] Grid projections and spatial matrices

Hi,

Two questions really (elaborated below): (1) Has anyone created what is
essentially a spherical (or at least hemispherical) matrix structure
that I can use normal R functions like apply() on? and (2) has anyone
coded the procedure described in the ref below to calculate effective
sample sizes of correlations between two spatial matrices? As the first
author is clearly an R user I had expected to find something, but quite
a lot of searching has so far drawn a blank.

Clifford, P., Richardson, S. & Hemon, D. (1989). Assessing the
significance of the correlation between two spatial processes.
Biometrics, 45, 123-134.

As the first question is the most involved, this is the background: I'm
looking at presence / absence data for a range of species. Up to now, I
have mainly worked with distributions easily mapable on a regular grid.
I've developed a number of functions that use arrays as a way of
representing these data: y & x references in the first two dimensions,
species ID in a third. Several of these functions compute turnover in
species distirbution - they check neighbouring boxes within the grid for
presence / absence of the same species and compute statistics based on
this. This is all very well when the basic projection is a simple 2d
matrix. Recently, however, I have started using larger scale datasets
where appropriate projections need to be used - most of this data is
projected onto a 10x10km UTM based grid reference system (in practice,
the Military Grid Reference System). I need to adapt my functions to
recognise a dataset that has this projection - ie, that cells in
different sectors can be neighbours. I appreciate that this might
require a complete rewriting of my functions and a new way of thinking
about these data, but the most obvious solution to me is simply to
create a matrix or array type object that is sort-of "zipped" together
along the edges of the sector, to retain appropriate neighbour
identification. As an example of the sort of basic calculation involved,
I include below a small function below that calcualtes one parameter of
interest - related to the number of species that a species if present in
the focal quadrat, an in its neighbouring ones that I currently use on
my flat 2d array type data - I've also included some toy distributions
so you can see how it works. Any suggestions/pointers would be very
welcome (and I'm sure the original code could be more elegant too!).

Thanks very much,

Colin
Here are some ideas you might consider. 

First you could use a different map projection that doesn't require stiching together sectors.  There are many possibilities and several websites offer guidance, for example:

http://www.colorado.edu/geography/gcraft/notes/mapproj/mapproj_f.html
http://www.gisdevelopment.net/tutorials/tuman007.htm

Factors in selection of a projection include size and shape of study area, and whether equal areas, correct angular relations, or equal distances from a central point are more important.

Second, you could consider a truly spherical grid system of which there are also some options.  One website of interest is:

http://www.sou.edu/cs/sahr/dgg/

Finally, for computing turnover between neighboring cells using a Jaccard or similar measure, a hexagonal grid, either in the plane or on the sphere, offers an unambiguous directional grid, i.e., you don't have to choose between rook's case and queen's case to determine neighbors.  If you are interested in this we could converse more off-list.

Denis White
	[[alternative HTML version deleted]]


