# [postgis-users] Hex grid value interpolation

Rémi Cura remi.cura at gmail.com
Fri Aug 1 06:19:01 PDT 2014

The answer may depend on the coverage of points you have.

1.) full postgis
If you have a lot of points (meaning few hex without data), you can simply
try to give the 0 hex a value following a function of the value of the
neighbours.

For instance, take the N nearest neighbour (called NN) that have a value!=0
along with there distance to the 0 hex, then update the 0 hex with average
value of NN weighted with the distance.

2.) Postgis+PL/R
If you have very few point it should be easier to use PL/R to perform
krigging on your point, thus giving you
_ a 2D grid with value for each cell. Then you transfer the value from grid
to hex by simple intersection.
_a mathematical function that for a given X,Y return a value. You just have
to evaluate it for every hex.
(the krigging output depends on what you uses in R)

3.)Postgis+Grass (which must be binded to R)
grass gives access to kriging methods. This allow you to avoid installing
pl/R

Cheers,
Rémi-C

2014-08-01 14:26 GMT+02:00 Dave Barter <dave.barter at gmail.com>:

> I have a table of tessellated hexagons that I created as a hex binning
> grid to cover an area.
>
> I've then overlaid a point set to give some of the hexagons a value. The
> shapes with value "0" have no value and I'd like to interpolate these from
> the values of the neighbours (ie. as per Kriging or other algorithm). How
> can I accomplish this in postgis given my table looks like:-
>
> hex_grid_data
> (
>  gid SERIAL,
>  wkb_geometry (geometry),
>  value INTEGER
> )
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140801/27f060e1/attachment.html>