Ich weiß nicht, um welche Art von Interpolation es sich handelt, aber wenn der Durchschnitt aller Nachbarn einen guten Wert hat, könnte dies die Lösung sein:
create table hex_grid_data_av as
(
select gid, wkb_geometry, value,
case
when value > 0 then value
else (select sum(h2.value)/6 from hex_grid_data h2 where ST_Touches(h1.wkb_geometry, h2.wkb_geometry))
end as int_value
from hex_grid_data h1
)
Oder wenn Sie @MakinFlippyFloppy folgen, bezweifeln Sie, dass wirklich 0 im Beispiel null bedeutet (kein Wert):
create table hex_grid_data_av as
(
select gid, wkb_geometry, value,
case
when value > 0 then value
else (select sum(coalesce(h2.value,0))/6 from hex_grid_data h2 where ST_Touches(h1.wkb_geometry, h2.wkb_geometry))
end as int_value
from hex_grid_data h1
)
Oder wenn Null- oder Nullwerte den Durchschnitt nicht verringern sollen:
create table hex_grid_data_av as
(
select gid, wkb_geometry, value,
case
when value > 0 then value
when value = 0 and not exists (select 1 from hex_grid_data h2 where ST_Touches(h1.wkb_geometry, h2.wkb_geometry) and h2.value != 0 and h2.value is not null ) then 0
else (select sum(coalesce(h2.value,0))/(select count(nullif(value,0)) from hex_grid_data h3 where ST_Touches(h1.wkb_geometry, h3.wkb_geometry) ) from hex_grid_data h2 where ST_Touches(h1.wkb_geometry, h2.wkb_geometry))
end as int_value
from hex_grid_data h1
)