Hydrologic Modeling in Oak Woodland SoilscapesResearch SitesNavigationUser loginWho's onlineThere are currently 0 users and 2 guests online.
|
Generation of Vegetation Sampling AreasSubmitted by dylan on Wed, 2008-02-27 20:06.
# 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 ## load libs librart(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') ## load libs librart(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')
|