Generation of Vegetation Sampling Areas

Submitted by dylan on Wed, 2008-02-27 20:06.

 
Premise:
We need some randomly selected areas for performing a vegetation survey. Two possible approaches are given: random selection of grid cells from a 7x7 grid superimposed over the region of interest, and random generation of 100x100 meter blocks which meet certain criteria on how close they can be from each other and the edges of the region. The region and grid files are attached at the bottom of this page.

 
Generate Region Data

# this ensures that we always get a cell that is completely in the region
v.mkgrid map=grid position=region grid=7,7 --o

# simple polygon defining current region
v.in.region out=reg

 
Compute Random Grid Cells

## load libs
library(maptools)
library(spgrass6)
library(spatstat)

## approach 1: select random grid cell
## read in data
x <- readVECT6('grid')

## note the comma in there, to select a named row and all columns
grid10 <- x[sample(length(slot(x, "polygons")), 10), ]

## write back to GRASS (or where ever)
writeVECT6(grid10, 'grid10')

Random Grid Cell ExampleRandom Grid Cell Example

 
Generate Randomly Placed Blocks

## load libs
library(maptools)
library(spgrass6)
library(spatstat)


## read in the rectangle which defines in the region of interest
reg <- readVECT6('reg')

## load custom function (see attached file below...)
source('functions.R')

## use custom function (see attached file below...)
## spatstat style sampling: with rSSI()
SP <- rnd_blocks(region=reg, n.blocks=10, block.edge.length=100, min.rad.sep=2, min.rad.edge=1)

## save result back to GRASS
writeVECT6(SP, 'blocks')

Random Block ExampleRandom Block Example




 
Additional Example: Compute 3 blocks per "half" of the watershed.

Random Block Example 2Random Block Example 2

AttachmentSize
grid_and_region_files.tar_.gz2.53 KB
functions.R1.96 KB
( categories: )