[GRASS-user] Re: r.surf.nnbathy interpolation to whole region

Maciej Sieczka tutey at o2.pl
Mon Aug 27 13:47:40 EDT 2007

Luigi Ponti wrote:

> I have successfully included natural neighbor interpolation in my 
> mapping routine via r.surf.nnbathy: it seems slower (is that OK?)
> than v.surf.idw but sounds a lot more robust from what I have read
> around

I'd only like to stress that it really depends on what your input data
looks like and what the purpose is. Each interpolation method has it's
cons and pros. There is no single most robust method for all applications.

> -- this is very useful if the interpolated raster is to be
> used for further analysis, beyond visualization.
> Currently, the interpolated raster output I get from r.surf.nnbathy
> is confined to the convex hull delimited by the outermost input 
> points/cells. Would there be a way to extend the interpolated raster
> to the whole current region as in v.surf.idw

1. Note the hardcoded "-W 0" in the script. You can set it to something
smaller if you want to extrapolate beyond the convex hull. However, I
don't think this makes much sense - set "-W -2" and see how bad the
output DEM looks on the edges. And it can't look better, for how the
triangulation works. Triangulation is restricted to the convex hull
made of input points.

2. Even if your input raster is bigger than your current region,
r.stats, which is used in r.surf.nnbathy script to create the x,y,z
input for nnbathy, discards input raster's cells outside the current
region. Thus, the convex hull is created only for non-null input points
falling into the current region. And the convex hull shape will depend
on how the input non-null cells falling into the current region are
distributed. If you want a perfectly rectangular convex hull, make sure
there is a non-null input raster cell in each region's corner.

I'll think of automating this. Next vacation maybe :).

> (in principle this
> seems possible: outer Voronoi cells just get bigger)?

I don't exactly understand what you mean. Could you elaborate please?

> By looking at r.surf.nnbathy code and nnbathy --help, it seems that 
> nnbathy should produce a rectangular grid of <cols> by <rows>. What
> am I missing?

Yes, it does produce a rectangular grid. Only that all the cells
outside the convex hull are null.


I'm very glad r.surf.nnbathy is usefull for you. Please drop me a line
if you publish anything where it's involved.

More information about the grass-user mailing list