[gdal-dev] gdal_grid: number of data points to use

Even Rouault even.rouault at mines-paris.org
Sat Jan 18 08:51:23 PST 2014

Le samedi 18 janvier 2014 16:47:23, Jan Hartmann a écrit :
> Thanks Even. How difficult would it be to let gdal_gid use the nearest
> points? The way it works now does not make much sense for mapping.

The points would need to be accumulated in an array and sorted by distance to 
the point being computed. Nothing terribly difficult. However I guess the 
max_points option, as currently implemented, was added to make the computation 
faster, so that would defeat a bit that purpose since you'd have to collect 
all them.

> Another very usable solution would be to select the nearest points in
> each quadrant relative to the interpolation point (NE, SE, SW, SE). It
> is available in dedicated interpolation programs like Surfer, and I
> always found it very useful.

Yes that would make sense. I'm not sure what's the interest currently in 
computing the weight contribution of points that are further than the closest 
points. But finding those nearest points would mean to go through all the 
possible points of the search ellipse, so that would not speed things up.

I have already implemented speeding up the nearest neighbour algorithm by 
using a in-memory spatial indexing of the point layers. The inverse distance 
to a power algorithm could likely take advantage of this too.

> Funding would be possible.
> Jan
> On 01/18/2014 01:50 PM, Even Rouault wrote:
> > Le samedi 18 janvier 2014 12:48:23, Jan Hartmann a écrit :
> >> gdal_grid has the option to set a minimum and maximum number of data
> >> points to use for interpolation. How are these data points selected from
> >> the total number of points? Are they always the nearest points to the
> >> grid-point that is interpolated?
> > 
> > Jan,
> > 
> > if less than min_points match the selection of the algorithm, the nodata
> > value will be returned
> > and when iterating over source points (in the order they are present in
> > the source OGR layer), the algorithm will stop as soon as max_points is
> > reached. The selected points are consequently not necessarily the
> > nearest points, but they will be contained in the search ellipse (since
> > max_points is only taken into account if you define radius1 and radius2)
> > 
> > Even

Geospatial professional services

More information about the gdal-dev mailing list