Great package! It is a really good addition to R. I have been learning how to use RGeoS for a few months now, and have been getting successful results. I have mainly been using your package to create bathymetry maps of a series of lakes that I am working on. I have two questions, that I cannot seem to work out by myself.
The first questions relates to extending the range of simulation in my models so that I can create depth-profile maps which fill the lake boundary. In other words, I want to have a simulated data point for all points within a polygon which is not limited by the extent of my sampling locations. I have attached an image of a map I have created using RGeoS, and the white areas is where I have not collected data, and where I wish to extend the range of modelling to.
here is a sample of my code:
- Code: Select all
#Create database
z.db <- db.create(DT.z, flag.grid=FALSE, ndim=2, nx=c(n.nodes.x1, n.nodes.x2))
z.db <- db.locate(z.db, c("x","y"), "x")
#Create variogram and model
z.2dir.vario <- vario.calc(z.db, lag=lag.distance, nlag=lag.number, dir=c(45, 135))z.2dir.model <-
model.auto(z.2dir.vario, struct=c("Nugget Effect", "Spherical"), title = "2 directional variogram model")
#Create grid mesh
depth.db <- db.polygon(z.db, polygon)
grid.db.z <- db.grid.init(depth.db, n=c(n.nodes.x1, n.nodes.x2))
grid.poly <- db.polygon(grid.db.z, polygon)
#Kriging
depth.db <- xvalid(depth.db, z.2dir.model, moving.neigh)
depth.db <- db.locate(depth.db, seq(6,7))
depth.db <- db.locate(depth.db, "z", "z")
grid.db.z <- kriging(depth.db, grid.poly, z.2dir.model, unique.neigh, radix="KU.Part")
grid.db.z <- kriging(depth.db, grid.poly, z.2dir.model, moving.neigh, radix="KM.All")
grid.db.z <- neigh.test(depth.db, grid.db.z, z.2dir.model, moving.neigh, radix="Moving")
#Gaussian Transformation
depth.anam <- anam.fit(depth.db, "z")
depth.db <- anam.z2y(depth.db, "z", anam=depth.anam)
depth.g.vario <- vario.calc(depth.db, nlag=lag.number, lag=lag.distance, dir=c(45, 135))
depth.g.model <- model.auto(depth.g.vario, struct=c("Nugget Effect", "Spherical"))
#Simulation
grid.db.z <- simtub(depth.db, grid.db.z, depth.g.model, unique.neigh, nbsimu= 50, nbtuba=100)
grid.db.z <- anam.y2z(grid.db.z, ngrep="Simu.Gaussian.z", anam=depth.anam)
grid.db.z.mean <- db.compare(grid.db.z, ngrep="Raw.Simu.Gaussian.z", fun="mean")
grid.db.z.stdv <- db.compare(grid.db.z, ngrep="Raw.Simu.Gaussian.z", fun="stdv")
My second questions relates to fitting coloured scale bars to the plots. I cannot figure out an easy way to do this. I have noticed on some of the graphs in your demonstration/tutorial packages, that your simulated graphs have coloured scales. Is there a code to easily do this?
Cheers
Chris