autoSurface = function(x, y, z, to.grid)

# Calculates a surface grid for the desired property and returns a set of values. These can be joined back to the provided data frame

{

 df = na.omit(data.frame(x=x, y=y, z=z))

 coordinates(df) <- ~x+y

 kr.grid <- gstat::idw(z~1, df, to.grid, idp = 2);

 result <- data.frame( p=kr.grid$var1.pred, v=kr.grid$var1.var, m=rep("IDW", nrow(kr.grid)))

 return(result);

}

autoOGIP = function()

{

}

createGrid = function(x.min, x.max, x.pts, y.min, y.max, y.pts)

{

 grd <- expand.grid(x=seq(from=x.min, to=x.max, length.out=x.pts), y=seq(from=y.min, to=y.max, length.out=y.pts))

 coordinates(grd) <- ~x+y

 #gridded(grd) <- TRUE

 return(grd);

}