[OSGeo-Discuss] How to interpolate rasters at each vector point?

Moskovitz, Bob@DOC Bob.Moskovitz at conservation.ca.gov
Tue Aug 13 00:57:05 PDT 2013

> QGIS Point sampling plugin? Postgis 2 can now do this too, but it's
> quite a bit slower right now.
> I'm confused about the interpolation role in this, does that just apply
> to cases where a point lands on the edge between pixels?
> Thanks,
> Alex
I've tried using the Point Sampling plugin, but it appears that it uses nearest neighbor interpolation.  I just discovered that SAGA can do what I need:
   # convert 2 rasters to SAGA Rasters with resolution of 0.01 degrees
   saga_cmd libio_gdal.so          "GDAL: Import Raster"         -FILES  PGA.tif                             -GRIDS PGA.sgrd
   saga_cmd libio_gdal.so          "GDAL: Import Raster"         -FILES  MM.tif                              -GRIDS MM.sgrd
   # Add Interpolated values to borehole location.
   saga_cmd libshapes_grid.so "Add Grid Values to Points" -SHAPES sample_location.shp -GRIDS PGA.sgrd -INTERPOL "Bilinear Interpolation" -RESULT tmp.shp
   saga_cmd libshapes_grid.so "Add Grid Values to Points" -SHAPES tmp.shp                       -GRIDS MM.sgrd  -INTERPOL "Nearest Neighbor"      -RESULT sl.shp

It can take days to compute PGA and MM, so I am using interpolation to work around this problem.


More information about the Discuss mailing list