Skip to content
Prev 5061 / 29559 Next

Masking interpolations

Hi,

If you want to use the standard convex hull of automap, just omit the 
new_data argument. That will stuff 5000 points into the convexhull on a 
regular grid. If you want to specify the pixelsize you need to adapt the 
create_new_data function like this:

create_new_data = function(obj) {
# Function that creates a new_data object if one is missing
        convex_hull = chull(coordinates(obj)[,1],coordinates(obj)[,2])
        convex_hull = c(convex_hull, convex_hull[1]) # Close the polygon
        d = Polygon(obj[convex_hull,])
	# This line is different, in addition I assume that your coordinates are in meters
        new_data = spsample(d, type = "regular", cellsize = 10e-2)
        gridded(new_data) = TRUE
        return(new_data)
}

# perform the interpolation
kr = autoKrige(I~1, a, create_new_data(a), nmax=100)

cheers,
Paul
Wesley Roberts wrote:
You need to either omit the grd part from the call to autoKrige or use 
the new function I showed above.