Skip to content
Prev 5055 / 29559 Next

Masking interpolations

Hi Wesley,

You could take a look at using a convex hull. I'm not sure if this will 
fix your problem as we cannot see how exactly your points are irregular. 
The latest version on my website (0.5-2) uses a convex hull off the data 
if you don't pass a new_data object. You could try this. The function 
making the convex hull is:

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,])
        new_data = spsample(d, 5000, type = "regular")
        gridded(new_data) = TRUE
        return(new_data)
}

If you want to call it directly from the package use 
automap:::create_new_data.

cheers,
Paul
Wesley Roberts wrote: